On this page⌄
Docs · Reference
API
Use your CCode key from any tool that speaks the OpenAI or the Anthropic format.
- Address
- api.ccode.si
- Formats
- OpenAI · Anthropic
- Models
- 26
- Plan
- Starter · Pro
Who can use it#
Other tools need a paid plan. A key on Starter or Pro works from any agent, editor or script, on all 26 models.
The Free plan and launch offers work in the CCode app only. From another tool they answer 403 plan_required.
Address and key#
Every request goes to https://api.ccode.si/v1 with your key. Create one under API keys in your account. Send it either way:
Authorization: Bearer $CCODE_API_KEY
x-api-key: $CCODE_API_KEYIn a tool's settings: for the OpenAI format, set the base URL to https://api.ccode.si/v1. For the Anthropic format, set it to https://api.ccode.si.
- POST/chat/completionsA model's answer, in the OpenAI format.
- POST/messagesA model's answer, in the Anthropic format.
- POST/messages/count_tokensHow many input tokens a request would use.
- GET/modelsThe models your key can use, with prices and size limits.
- GET/keyYour key's plan, credits and rate limits.
- GET/limitsWhat you have used of each limit, and when it resets.
- GET/usageRequests, tokens and cost per day and model. Takes from and to dates.
- GET/generation/{id}One request's tokens and cost, by its request id.
OpenAI format#
Chat completions, with streaming, tools and images. The answer's usage includes what the request cost, in dollars.
curl https://api.ccode.si/v1/chat/completions \
-H "Authorization: Bearer $CCODE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.3",
"stream": true,
"messages": [{ "role": "user", "content": "Explain this stack trace." }]
}'Anthropic format#
Messages, with streaming, tools, images and thinking. Any model answers in this format too, not only Claude.
curl https://api.ccode.si/v1/messages \
-H "x-api-key: $CCODE_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-5-5",
"max_tokens": 1024,
"messages": [{ "role": "user", "content": "Explain this stack trace." }]
}'Models#
GET /models lists every model your key can use, with its price per million tokens, context window and output limit. Both formats take the same names.
- Claude Opus 5.5claude-opus-5-5
- Claude Fable 5.2claude-fable-5-2
- GPT-6.2 Solgpt-6.2-sol
- GLM 5.3glm-5.3
- Kimi K3.1 Prokimi-k3.1-pro
- DeepSeek V4.1 Flashdeepseek-v4.1-flash
Prices are each maker's own, listed on the pricing page. Names ending in -free are the free allowance and work in the CCode app only.
Limits#
Usage is counted in dollars at the model's price and held to three limits that refill on their own. Up to $35 a month can go to Claude models.
- StarterEvery 5 hours$1Every week$2.5Every month$5At once8 requests
- ProEvery 5 hours$14Every week$35Every month$70At once8 requests
Requests a minute are in the x-ratelimit headers and in GET /key. The GET requests share 120 a minute, four at a time.
Response headers#
- x-request-idThe request's id. Quote it when you write to us.
- x-ratelimit-limit-requestsRequests a minute your key may make.
- x-ratelimit-remaining-requestsHow many of those are left this minute.
- x-ratelimit-reset-requestsSeconds until the minute starts again.
- x-credits-remainingYour credits after this request, in dollars.
- x-ccode-limit-5h-remainingDollars left in the 5-hour limit. The same pair exists for weekly and monthly.
- x-ccode-limit-5h-resetWhen that limit resets.
- retry-afterOn a 429, 503 or 529: seconds to wait before trying again.
Prompt caching#
On Claude models, the part of a conversation the model has already read is billed at the cached price. If your tool sets cache_control, it is used as sent. If it sets none, caching is added for you.
Not supported#
Server-side tools (web search, web fetch, code execution), remote MCP servers and code-execution containers are refused with unsupported_feature. These fields are ignored: n, best_of, service_tier, prediction, modalities, audio, web_search_options.
Errors#
An error comes back in the format of the request, with a message written to be shown to a person.
{
"error": {
"message": "Rate limit reached: 60 requests per minute. Retry after 12s.",
"type": "rate_limit_error",
"code": "rate_limit_exceeded"
}
}{
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "Rate limit reached: 60 requests per minute. Retry after 12s."
}
}The Anthropic format has no code: go by the status and the type. In a stream, a failure after the first tokens arrives as an error event of type overloaded_error or api_error.
A request that is refused is not charged.
Error codes#
- 400—The body isn't valid JSON, messages isn't a list, or the input is longer than the model accepts.Fix the request. Retrying it unchanged fails the same way.
- 400unsupported_featureThe request uses a server-side tool, a remote MCP server or a container.Define the tool as your own function tool.
- 400reasoning_not_supportedThe reasoning level isn't available for this model on your plan.Ask for a lower level, or leave it out.
- 400context_length_exceededThe conversation is longer than the model's context window.Shorten or summarise it.
- 400invalid_requestThe model rejected the request as invalid.Check the parameters and the message format.
- 400content_policy_violationThe model's content policy rejected the request.Change the content.
- 400invalid_imageAn image couldn't be read: its format, size or address.Send a supported image.
- 401missing_api_keyNo key was sent.Send it as a Bearer token or in x-api-key.
- 401invalid_api_keyThe key is wrong, revoked or expired.Create a new key in your account.
- 402insufficient_creditsYour credits don't cover this request.Top up, or wait for your plan's next period.
- 403plan_requiredFree usage was asked for from outside the CCode app.Use a key with a paid plan, and the model's plain name.
- 403model_not_allowedYour plan doesn't include this model.Pick a model from GET /models.
- 404model_not_foundNo model has this name.Take the name from GET /models.
- 413—The body is larger than 20 MB.Send less, or smaller images.
- 429rate_limit_exceededToo many requests, or tokens, this minute.Wait the seconds in retry-after.
- 429concurrency_limit_exceededToo many of your requests are running at once.Wait for one to finish.
- 429usage_limit_reachedA 5-hour, weekly or monthly limit, or a model's monthly cap, is used up.The message and retry-after say when it resets.
- 429auth_rate_limitedToo many wrong keys from your address.Wait a minute.
- 500—Something failed on our side.Try again. If it keeps happening, send us the x-request-id.
- 502 · 503 · 504—The model's API is down right now.Try again in a few minutes, or use another model.
- 503 · 529—The model is overloaded. 503 in the OpenAI format, 529 in the Anthropic format.Wait the seconds in retry-after.
- 503busyOur service is busy.Wait the seconds in retry-after.
API · from $1 for $5 of usage
Get a plan