翻篇收录说明
翻篇网页快照

BYOK Providers | Command Code - Command Code Docs

https://commandcode.ai/docs/byok

最近抓取:2026-12-04 15:53:57(北京时间)

最近内容变化:2026-12-02 12:23:53(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

Bring your own provider to Command Code: any OpenAI-compatible or Anthropic-wire endpoint, hosted APIs, local servers, or proxies with your own key.

正文摘录

BYOK ProvidersToggle SidebarHomeReferenceModelsPricingChangelogLoginOn this pageOverviewCopy PageBYOK BetaBYOK is currently in beta and subject to improvements. Bring your own provider and use it in Command Code CLI. Any OpenAI or Anthropic compactible API can serve models in Command Code. You can bring your key from hosted providers (DeepSeek, OpenRouter, Vercel AI Gateway), local servers (Ollama, vLLM), or other coding agent's APIs. BYOK providers You can connect to any external provider in Command Code, requests go straight from your machine to that provider's endpoint with your key, never through Command Code's servers. BYOK providers can be managed from /connect in the Command Code CLI. Below are providers and instructions on how to connect to them. Command Code Command Code is the default and recommended provider. Every model in /model routes through your plan, and the models are optimized for the cmd harness. That optimization is real engineering: see Harness Engineering for how the harness repairs, steers, and optimizes models. The /model menu can be used to access models from Command Code and BYOK providers. BYOK models are active alongside Command Code models, and you switch back to Command Code models anytime through the model menu. OpenAI ChatGPT/Codex You can use your ChatGPT Pro/Plus subscription directly in Command Code. Select OpenAI ChatGPT/Codex in /connect (or run cmd login openai, chatgpt works too) and sign in. The provider package installs on demand at first login, and its models appear as their own section in /model. Requests run locally from the CLI over your subscription. GitHub Copilot Same flow for an active GitHub Copilot subscription: select GitHub Copilot in /connect (or cmd login copilot), complete the device sign-in, and the copilot provider's models will be listed in /model. Adding a custom provider The /connect menu supports 150+ providers out of the box. For those, the endpoint, wire, and current model list come prefilled. Anything else works too: any OpenAI-compatible or Anthropic-wire endpoint can also be setup. Run /connect and pick (BYOK) Add your own provider. From the supported providers list (the happy path) The connect menu supports 150+ providers with endpoint, models, and config prefilled. You can search and pick a provider from this menu. 1Pick the providerStart typing at the id step (openrouter, deepseek, groq, …) and a browsable list of known providers shows under the input. Pick one with ↑/↓ + enter; the wire and endpoint prefill.2Paste your keyKeys are stored securely in ~/.commandcode/auth.json. Press enter on the empty field if the endpoint takes no key (local servers).3Models arrive on their ownDiscovery is silent: the provider's current model list, names and context windows included, is imported for you. Finishing lands you in /model with the new models selectable and routing. Not in the list (fully custom) If your provider is not in the menu, or you want to declare a custom/local one, follow these steps: 1Name itType any id, a short lowercase handle (work-llm). It names the entry in ~/.commandcode/providers.json and prefixes its models (work-llm/gpt-x).2Pick the wireOpenAI-compatible (/chat/completions, the default: Ollama, vLLM, LM Studio, most hosted APIs), OpenAI Responses (/responses, for endpoints speaking the OpenAI Responses API), or Anthropic (/v1/messages, for endpoints speaking the Claude Messages API).3Point at the endpointThe API root. OpenAI-compatible servers usually end in /v1; Anthropic roots get /v1 added on the wire when missing. A pasted URL carrying a route suffix (…/v1/chat/completions) is trimmed to the root automatically, with a note showing what was removed.4Add the key, or skip itKey is securely stored in auth.json. Press enter on the empty field if the endpoint takes no key (local servers).5Declare the modelsThe menu asks the endpoint's own /models listing first. If that comes up empty, you can either type ids there or modify the providers.json file to add the models. See the config schema below for details. Press h on any non-typing step for the condensed version of all of this; esc (or ← where it can't mean cursor movement) goes back one step. NoteYou can also just ask the agent: add OpenRouter as a provider and enable deepseek/deepseek-v4-flash. It reads its bundled BYOK reference, looks up current model ids and context windows when it needs them, and writes the providers.json entry for you. Review it like any other edit. Provider config schema Everything related to byok providers lives in ~/.commandcode/providers.json. It is yours to edit, and changes apply live (reopen /connect or /model). For example: // ~/.commandcode/providers.json { "provider": { "acme": { "name": "Acme AI", "baseURL": "https://api.acme.example/v1", "apiKey": "$ACME_API_KEY", "models": { "qwen/qwen3.6-27b": { "name": "Qwen 3.6 27B", "contextWindow": 131072, "maxOutput": 16384, "reasoningEfforts": ["low", "high"], "cost": { "input": 0.4, "output": 1.6 }, "options": { "temperature": 0.6 } } } }, "claude-proxy": { "api": "anthropic-messages", "baseURL": "https://api.acme.example/anthropic", "apiKey": "$ACME_API_KEY", "models": { "minimax/minimax-m2.7": {} } }, "ollama": { "baseURL": "http://localhost:11434/v1", "apiKey": false, "models": { "llama3.3:70b": {} } } } } Copy Provider fields FieldValuesNotesnamestringDisplay name in /connect and /model; defaults to the idapiopenai-completions (default) | openai-responses | anthropic-messagesOmit for OpenAI-compatible endpoints. openai-responses posts to {baseURL}/responses. Any other value skips the providernpmAI-SDK package nameCompat only: @ai-sdk/openai-compatible & @ai-sdk/openai map to openai-completions, @ai-sdk/anthropic to anthropic-messages; any other package warns and assumes openai-completions. Ignored when api is set.baseURLURLRequired. The API root requests go to. Missing or invalid URL skips the provider. Also read from options.baseURL (top-level wins)apiKey"$ENV_VAR" | "{env:VAR}" | "!command" | falseA key saved via /connect wins over this field. It is reference to the key, never the key itself. "$VAR" and "{env:VAR}" read that env variable; "!command" runs the command and uses its output; false = keyless endpoint, no auth header sent. A pasted raw secret is refused with a warning.headersobjectExtra request headers, string values only. One non-string value drops the whole object with a warning. Every request identifies itself with a User-Agent starting command-code/<version> unless you declare your own User-Agent herezdrtrueYou vouch that this endpoint keeps no data (a local model, or your own gateway enforcing ZDR). Only then do its models run under CMD_ZDR=1; without it they are refused there. Any non-boolean value warns and is ignoredmodelsobjectRequired. {} per id is enough. Zero valid models skips the providerdisabledtrueTombstone: the entry is skipped silently, no warning. "enabled": false means the same Model fields Every field is optional but we recommend adding contextWindow as a bare minimum. "a-model-id": {} is a complete declaration: FieldValuesNotesnamestringDisplay name in /modelcontextWindownumber > 0Tokens. Compat alias: limit.context (contextWindow wins when both are set) Default: 200KmaxOutputnumber > 0Tokens. Compat alias: limit.outputreasoningbooleantrue assumes the efforts low / medium / high; false declares nonereasoningEffortsstring[]Exact valid set: low | medium | high | xhigh | max. Unknown levels are dropped with a warningcostobject$ per 1M tokens: input, output, cacheRead, cacheWrite (snake_case cache_read / cache_write accepted); 0 is valid for free modelsoptionsobjectExtra request-body params merged into every call for this model (temperature, top_p, …)apiopenai-completions | openai-responses | anthropic-messagesPer-model wire override. Defaults to the provider's api. One entry can serve some models over Chat Completions, some over the Responses API, and some over the Anthropic wire. An invalid value skips this model onlybaseURLURLPer-model endpoint override. Defaults to the provider's baseURL. An invalid URL skips this model only A non-object model value skips that model with a warning; sibling models survive. Reasoning efforts are auto-detected for known providers. If not added automatically, the onus to add them manually is on the user. Declare the supported efforts in the model's reasoningEfforts field inside the ~/.commandcode/providers.json file. Example provider config Below are examples of BYOK providers added in ~/.commandcode/providers.json. Command Code is the default provider, nothing to declare for it. OpenRouter // ~/.commandcode/providers.json { "provider": { "openrouter": { "name": "OpenRouter", "baseURL": "https://openrouter.ai/api/v1", "apiKey": "$OPENROUTER_API_KEY", "models": { "deepseek/deepseek-v4-flash": {} } } } } Copy Mixed wires on one gateway: a gateway whose default is OpenAI-compatible can still serve individual models over the Responses API or the Anthropic wire. Declare the exception on the model. // ~/.commandcode/providers.json { "provider": { "my-gateway": { "name": "My Gateway", "baseURL": "https://gateway.example.com/v1", "apiKey": "$MY_GATEWAY_API_KEY", "models": { "vendor/chat-model": {}, "vendor/responses-model": { "api": "openai-responses" }, "vendor/messages-model": { "api": "anthropic-messages" } } } } } Copy Vercel AI Gateway // ~/.commandcode/providers.json { "provider": { "vercel": { "name": "Vercel AI Gateway", "baseURL": "https://ai-gateway.vercel.sh/v1", "apiKey": "$AI_GATEWAY_API_KEY", "models": { "deepseek/deepseek-v4-flash": {} } } } } Copy Cloudflare AI Gateway: its OpenAI-compatible root carries your account and gateway ids, and model ids are provider/model as the gateway spells them: // ~/.commandcode/providers.json { "provider": { "cf-gateway": { "name": "Cloudflare AI Gateway", "baseURL": "https://gateway.ai.cloudflare.com/v1/<account>/<gateway>/compat", "apiKey": "$CF_AI_GATEWAY_TOKEN", "models": { "anthropic/cla