npm.io
0.1.3 • Published 9h agoCLI

codefree-proxy

Licence
MIT
Version
0.1.3
Deps
1
Size
78 kB
Vulns
0
Weekly
0

codefree-proxy

OpenAI-compatible local proxy for SRD Cloud CodeFree.

Quick start

Run in the background:

npx codefree-proxy start --port 8788 --host 127.0.0.1

Or install globally:

npm install -g codefree-proxy
codefree-proxy start --port 8788 --host 127.0.0.1

Foreground mode is also available when you want logs printed in the current terminal:

npx codefree-proxy --port 8788 --host 127.0.0.1

The server prints the local base URL and endpoints after it starts.

Server running at: http://127.0.0.1:8788
OpenAI Base URL:  http://127.0.0.1:8788/v1
Chat endpoint:   POST http://127.0.0.1:8788/v1/chat/completions
Models endpoint: GET  http://127.0.0.1:8788/v1/models
Health check:    GET  http://127.0.0.1:8788/health
Stop command:    codefree-proxy stop --port 8788

Use this OpenAI-compatible base URL in clients:

http://127.0.0.1:8788/v1

Use any API key value in OpenAI-compatible clients, or omit it if the client allows.

Login

The proxy first tries existing local credentials. If credentials are missing, run:

npx codefree-proxy login

The login flow matches CodeFree-O: it opens SRD Cloud OAuth in a browser, waits for the local callback, fetches encryptedApiKey, decrypts it, and saves credentials locally.

Check current credential status:

npx codefree-proxy status

Remove saved credentials:

npx codefree-proxy logout

Background mode

Start the server in the background:

npx codefree-proxy start
npx codefree-proxy start --port 8788 --host 127.0.0.1

Background logs are written to:

~/.codefree-proxy/logs/proxy.log

The process id is written to:

~/.codefree-proxy/proxy.pid

Stop the server

Default port:

npx codefree-proxy stop

Custom port:

npx codefree-proxy stop --port 8788

Commands

codefree-proxy --port 8788 --host 127.0.0.1
codefree-proxy start
codefree-proxy start --port 8788 --host 127.0.0.1
codefree-proxy login
codefree-proxy logout
codefree-proxy status
codefree-proxy stop
codefree-proxy stop --port 8788

Endpoints

  • POST /v1/chat/completions
  • GET /v1/models
  • GET /health
  • GET /auth/status
  • POST /auth/refresh

Models

  • GLM-5.1
  • GLM-4.7
  • Qwen3.5-122B-A10B

Unknown model names are mapped to GLM-5.1.

Credentials

Credentials are stored at:

  • macOS/Linux: ~/.codefree-proxy/config.json
  • Windows: %USERPROFILE%\.codefree-proxy\config.json

The proxy can also import CodeFree-O credentials from ~/.codefree-o/.local/share/codefree.json when available.

Keywords