Command Code Provider API
Command Code provides API endpoints compatible with OpenAI and Anthropic formats. You can utilize your Command Code plan and credits for the available models using any client that supports those standards.
| Endpoint | Method | Format |
|---|---|---|
https://api.commandcode.ai/provider/v1/chat/completions | POST | OpenAI Chat Completions |
https://api.commandcode.ai/provider/v1/messages | POST | Anthropic Messages |
https://api.commandcode.ai/provider/v1/models | GET | Models list |
Get an API key
Create your API key from Studio.
Command Code API requires the Pro plan or higher. See Pricing & Limits for plan tiers.
Send a request
Once you have your API key, you can send a request to one of the following endpoints.
OpenAI Chat Completions /v1/chat/completions
Anthropic Messages /v1/messages
All Command Code models are available via the API, see Pricing & Limits for the full model list and per-model pricing. You can fetch the live models list at runtime from /provider/v1/models.
List models
Streaming is supported and can be received by setting stream: true.
Streaming
Both endpoints emit token usage at the end of every stream — OpenAI clients see a final usage chunk, Anthropic clients see usage in the message_delta event. No opt-in required.
OpenAI clients see the standard error envelope:
Anthropic clients see:
Here are the common error cases:
| Status | Code / Type | When |
|---|---|---|
400 | unsupported_model | Model isn't in the catalog (OpenAI shape only — code is on the OpenAI envelope; the Anthropic envelope has type: invalid_request_error instead). |
400 | invalid_request_error | Wrong endpoint for the model (Claude on /chat/completions or non-Anthropic on /messages), bad request body, or malformed JSON. |
401 | authentication_error | Missing or invalid auth — pass Authorization: Bearer <token> (any route) or x-api-key: <token> (Anthropic SDK on /messages). |
403 | upgrade_required | Upgrade to Pro plan or higher. |
429 | rate_limit_error | Rate-limited by the upstream. Retry with backoff. |
5xx | server_error / api_error | Upstream failure. The body carries the upstream provider's error message. |
Which plans can use the Provider API?
Which plans can use the Provider API?
Pro plan or higher. Accounts on the Go plan get a 403 upgrade_required on every /provider/v1/* request and need to upgrade before they can call the API.
Can I get multiple completions per request?
Can I get multiple completions per request?
No. The endpoint returns one completion per request, n > 1 is rejected at the schema layer. Send parallel requests if you want multiple samples.
What content types are supported on user messages?
What content types are supported on user messages?
Text and image. Audio, file, and document parts are rejected by the schema. If the chosen model doesn't support vision the upstream provider returns its own error (we don't pre-gate per model).
Which models can I call?
Which models can I call?
Anthropic, OpenAI, and OSS models. See the Models section. Each endpoint accepts only its native wire shape: /chat/completions serves OpenAI and OSS models; /messages serves Anthropic models. Sending a Claude model to /chat/completions returns a 400 directing you to /messages, and vice versa.
Do I need a separate API key for this?
Do I need a separate API key for this?
No. Use the same Command Code API key you generate for the CLI / Studio. Get one at CommandCode Studio under Settings → API Keys.