@@ -35,9 +35,24 @@ The proxy loads your API key from (in order of priority):
3535
36361 . ` --api-key ` CLI flag: ` npx commandcode-api-proxy --api-key user_xxx `
37372 . ` CC_API_KEY ` environment variable
38- 3 . ` ~/.commandcode/auth.json ` (auto-generated by ` npx command-code ` )
38+ 3 . ` ~/.config/ commandcode-api-proxy /auth.json ` (saved via ` auth login ` )
3939
40- If you've already run ` npx command-code ` to log in, no extra setup is needed.
40+ On first run without a key, the proxy prompts you to enter one and persists it.
41+
42+ #### CLI auth commands
43+
44+ ``` bash
45+ # Save a new API key
46+ commandcode-api-proxy auth login
47+
48+ # Overwrite existing key
49+ commandcode-api-proxy auth login --force
50+
51+ # Remove saved key
52+ commandcode-api-proxy auth logout
53+ ```
54+
55+ Get your API key from https://commandcode.ai/settings .
4156
4257### CLI options
4358
@@ -46,14 +61,15 @@ If you've already run `npx command-code` to log in, no extra setup is needed.
4661| ` --host ` | Bind address | ` 127.0.0.1 ` |
4762| ` --port ` | Port | ` 8787 ` |
4863| ` --api-key ` | Command Code API key | — |
64+ | ` --setup-opencode ` | Generate OpenCode provider config | — |
4965
5066## Endpoints
5167
5268### ` POST /v1/chat/completions ` (OpenAI)
5369
5470``` bash
5571curl http://127.0.0.1:8787/v1/chat/completions \
56- -H " Authorization: Bearer user_xxx " \
72+ -H " Authorization: Bearer proxy-managed " \
5773 -H " Content-Type: application/json" \
5874 -d ' {
5975 "model": "deepseek/deepseek-v4-pro",
@@ -66,7 +82,13 @@ curl http://127.0.0.1:8787/v1/chat/completions \
6682
6783### OpenCode
6884
69- Add to your ` opencode.json ` (project root or ` ~/.config/opencode/opencode.json ` ):
85+ Run setup (writes to ` ~/.config/opencode/opencode.json ` ):
86+
87+ ``` bash
88+ npx commandcode-api-proxy --setup-opencode
89+ ```
90+
91+ Or add manually:
7092
7193``` json
7294{
@@ -76,28 +98,24 @@ Add to your `opencode.json` (project root or `~/.config/opencode/opencode.json`)
7698 "npm" : " @ai-sdk/openai-compatible" ,
7799 "name" : " Command Code" ,
78100 "options" : {
79- "baseURL" : " http://127.0.0.1:8787/v1"
101+ "baseURL" : " http://127.0.0.1:8787/v1" ,
102+ "apiKey" : " proxy-managed"
80103 },
81104 "models" : {
82- "deepseek/deepseek-v4-pro" : { "name" : " DeepSeek V4 Pro" },
83- "deepseek/deepseek-v4-flash" : { "name" : " DeepSeek V4 Flash" },
84- "MiniMaxAI/MiniMax-M2.7" : { "name" : " MiniMax M2.7" },
85- "MiniMaxAI/MiniMax-M2.5" : { "name" : " MiniMax M2.5" },
86- "zai-org/GLM-5.1" : { "name" : " GLM 5.1" },
87- "zai-org/GLM-5" : { "name" : " GLM 5" },
88- "moonshotai/Kimi-K2.6" : { "name" : " Kimi K2.6" },
89- "moonshotai/Kimi-K2.5" : { "name" : " Kimi K2.5" },
90- "Qwen/Qwen3.6-Max-Preview" : { "name" : " Qwen 3.6 Max" },
91- "Qwen/Qwen3.6-Plus" : { "name" : " Qwen 3.6 Plus" },
92- "Qwen/Qwen3.7-Max" : { "name" : " Qwen 3.7 Max" },
93- "Qwen/Qwen3.7-Plus" : { "name" : " Qwen 3.7 Plus" },
94- "stepfun/Step-3.5-Flash" : { "name" : " Step 3.5 Flash" },
95- "google/gemini-3.1-flash-lite" : { "name" : " Gemini 3.1 Flash Lite" },
96- "google/gemini-3.5-flash" : { "name" : " Gemini 3.5 Flash" },
97- "xiaomi/mimo-v2.5" : { "name" : " MiMo v2.5" },
98- "claude-sonnet-4-6" : { "name" : " Claude Sonnet 4.6" },
99- "claude-opus-4-7" : { "name" : " Claude Opus 4.7" },
100- "openai/gpt-5.5" : { "name" : " GPT 5.5" }
105+ "deepseek-v4-pro" : { "name" : " DeepSeek V4 Pro" , "limit" : { "context" : 1048576 , "output" : 393216 } },
106+ "deepseek-v4-flash" : { "name" : " DeepSeek V4 Flash" , "limit" : { "context" : 1048576 , "output" : 393216 } },
107+ "MiniMax-M2.7" : { "name" : " MiniMax M2.7" , "limit" : { "context" : 204800 , "output" : 32768 } },
108+ "MiniMax-M2.5" : { "name" : " MiniMax M2.5" , "limit" : { "context" : 204800 , "output" : 32768 } },
109+ "GLM-5.1" : { "name" : " GLM-5.1" , "limit" : { "context" : 200000 , "output" : 131072 } },
110+ "GLM-5" : { "name" : " GLM-5" , "limit" : { "context" : 200000 , "output" : 131072 } },
111+ "Kimi-K2.6" : { "name" : " Kimi K2.6" , "limit" : { "context" : 262144 , "output" : 98304 } },
112+ "Kimi-K2.5" : { "name" : " Kimi K2.5" , "limit" : { "context" : 262144 , "output" : 98304 } },
113+ "Qwen3.6-Max-Preview" : { "name" : " Qwen 3.6 Max Preview" , "limit" : { "context" : 262144 , "output" : 65536 } },
114+ "Qwen3.6-Plus" : { "name" : " Qwen 3.6 Plus" , "limit" : { "context" : 1048576 , "output" : 65536 } },
115+ "Qwen3.7-Max" : { "name" : " Qwen 3.7 Max" , "limit" : { "context" : 1048576 , "output" : 65536 } },
116+ "Qwen3.7-Plus" : { "name" : " Qwen 3.7 Plus" , "limit" : { "context" : 1048576 , "output" : 65536 } },
117+ "Step-3.5-Flash" : { "name" : " Step 3.5 Flash" , "limit" : { "context" : 262144 , "output" : 65536 } },
118+ "mimo-v2.5" : { "name" : " MiMo V2.5" , "limit" : { "context" : 1048576 , "output" : 131072 } }
101119 }
102120 }
103121 }
@@ -144,11 +162,14 @@ Short names work in addition to full model IDs:
144162| -------------------------------------- | ---------------------------- |
145163| ` deepseek-v4-pro ` , ` deepseek-v4 ` | ` deepseek/deepseek-v4-pro ` |
146164| ` deepseek-v4-flash ` , ` deepseek-flash ` | ` deepseek/deepseek-v4-flash ` |
147- | ` claude-sonnet-4-6 ` , ` claude-opus-4-7 ` | ` deepseek/deepseek-v4-pro ` |
148- | ` gpt-4 ` , ` gpt-4o ` , ` gpt-5 ` , ` gpt-5.5 ` | ` deepseek/deepseek-v4-pro ` |
149- | ` kimi-k2.6 ` , ` kimi-k2.5 ` | ` moonshotai/Kimi-* ` |
150- | ` qwen-3.6-max ` , ` qwen-3.6-plus ` | ` Qwen/Qwen3.6-* ` |
165+ | ` minimax-m2.7 ` , ` minimax-m2.5 ` | ` MiniMaxAI/MiniMax-* ` |
151166| ` glm-5.1 ` , ` glm-5 ` | ` zai-org/GLM-* ` |
167+ | ` kimi-k2.6 ` , ` kimi-k2.5 ` | ` moonshotai/Kimi-* ` |
168+ | ` qwen3.6-max ` , ` qwen3.6-plus ` | ` Qwen/Qwen3.6-* ` |
169+ | ` step3.5 ` | ` stepfun/Step-3.5-Flash ` |
170+ | ` mimo-v2.5 ` | ` xiaomi/mimo-v2.5 ` |
171+
172+ Any model ID is passed through as-is — the proxy does not validate against a fixed list.
152173
153174## License
154175
0 commit comments