API Documentation
One key for Claude / GPT / Gemini and Chinese models like Qwen / GLM / Kimi. OpenAI-compatible — change base_url and go. Anthropic-compatible endpoint for Claude Code. Official model names accepted.
1. Quick start
- Register at cocodot.co/register — verify email for $0.5 bonus credit, usable after your first top-up. Calling the API needs that first top-up plus your real name on the Identity verification page (about 1 minute, free).
- Create an API key in Console → AI.
- Point base_url at cocodot and call:
curl https://cocodot.co/api/ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-YOUR_KEY" \
-d '{
"model": "claude-opus-4-8",
"messages": [{"role": "user", "content": "Hello!"}]
}'Color legend: yellow = replace with your own value · green = model name · blue = cocodot endpoint (copy as-is)
2. Endpoints & auth
| Purpose | Endpoint | Auth |
|---|---|---|
| Chat (OpenAI-compatible) | POST /api/ai/v1/chat/completions | Authorization: Bearer sk-… |
| Messages (Anthropic-compatible) | POST /api/ai/v1/messages | x-api-key: sk-… or Bearer |
| Model dropdown (for clients) | GET /api/ai/v1/models | Public |
| Full list + live prices | GET /api/ai/models | Public |
Base URL for OpenAI SDKs / clients: https://cocodot.co/api/ai/v1 · For Anthropic SDK / Claude Code: https://cocodot.co/api/ai
3. Models, prices & official names
You can pass either the official model name or the cocodot short ID — both route, and bill, identically. Case-insensitive.
| Official name (examples) | Short ID | Model |
|---|---|---|
| claude-opus-5 | mco-7 | Claude Opus 5 |
| claude-sonnet-5 | mcs-6 | Claude Sonnet 5 |
| claude-opus-4-8 | mco-6 | Claude Opus 4.8 |
| claude-sonnet-4-6 | mcs-5 | Claude Sonnet 4.6 |
| claude-haiku-4-5 | mch-1 | Claude Haiku 4.5 |
| claude-fable-5 | mcf-1 | Claude Fable 5 |
| gpt-5.5 | mog-6 | GPT-5.5 |
| gpt-5.4 | mog-3 | GPT-5.4 |
| gemini-3.6-flash | mgg-12 | Gemini 3.6 Flash |
All available models (live)
Loading live model list…
Official names with a version (e.g. gpt-5.6-sol, claude-opus-5) map to that same model; a bare brand name (opus / sonnet / gpt, etc.) goes to the default model of that brand; models not in the catalog return a 400 error and are never swapped for another model. Current exceptions: ① newer Claude official names not yet in the catalog (e.g. claude-haiku-5-5) are routed like the bare brand name to an on-sale model in that line and billed at the price of that model; ② official names older than the versions on sale (e.g. gpt-4o, claude-opus-4-1, gemini-2.0-flash) are likewise routed to an on-sale model and billed at its price — but older GPT names with a tier suffix such as mini / nano / pro (e.g. gpt-4o-mini), GPT product names without a version (e.g. gpt-image-1), older Gemini Pro / Qwen Max versions and the like return 400; ③ product names of other brands without a version (e.g. qwen-vl-max, gemini-embedding-001) are currently routed by keyword to the default model of that brand and billed at the price of that model. Full live list & per-token prices: GET https://cocodot.co/api/ai/modelsPrice list →Cost calculator →
Claude Fable 5 (mcf-1) is available: its input and output rates are 15% below the official rates; for Claude Opus 5.5 (mco-8) and Sonnet 5.5 (mcs-7) they are 10% below — see the live table above for status and prices. · All models are capped at their official price; main models are 10% below it. Some models are tiered by input length — every tier is listed on the pricing page.
4. Code examples
Python(openai SDK)
from openai import OpenAI
client = OpenAI(
base_url="https://cocodot.co/api/ai/v1",
api_key="sk-YOUR_KEY",
)
resp = client.chat.completions.create(
model="claude-opus-4-8", # official name OK; "mco-6" also works
messages=[{"role": "user", "content": "Write a haiku about the sea"}],
)
print(resp.choices[0].message.content)Node.js(openai SDK)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://cocodot.co/api/ai/v1",
apiKey: "sk-YOUR_KEY",
});
const resp = await client.chat.completions.create({
model: "gpt-5.5",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0].message.content);Python(anthropic SDK,native Messages format)
from anthropic import Anthropic
client = Anthropic(
base_url="https://cocodot.co/api/ai", # note: no /v1 here
api_key="sk-YOUR_KEY",
)
msg = client.messages.create(
model="claude-opus-4-8",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}],
)
print(msg.content[0].text)More examples (LangChain / streaming / tool calling): github.com/cocodot2026/cocodot-api-examples ↗
5. Client setup
Every OpenAI-compatible client works. The four we get asked about most:
SillyTavern
- API → Chat Completion, source: Custom (OpenAI-compatible)
- Custom endpoint (Base URL):
https://cocodot.co/api/ai/v1· API key: yoursk-… - Click Connect — the model dropdown auto-fills (via /v1/models). Pick e.g. claude-opus-4-8 and chat.
Cursor
- Settings → Models → API Keys: paste your sk-… into "OpenAI API Key"
- Enable "Override OpenAI Base URL":
https://cocodot.co/api/ai/v1 - Add / tick the model names you want (claude-opus-4-8, gpt-5.5, …) and Verify.
Cline(VS Code)
- API Provider: "OpenAI Compatible"
- Base URL:
https://cocodot.co/api/ai/v1· API key: sk-… - Model ID: claude-opus-4-8 (or any official name).
Claude Code
export ANTHROPIC_BASE_URL=https://cocodot.co/api/ai
export ANTHROPIC_API_KEY=sk-YOUR_KEY
claude # then use Claude Code as usualModel names map automatically (fable → mcf-1, opus → mco-6, sonnet → mcs-5, haiku → mch-1). Details: /claude-code
6. Streaming
Pass stream: true — standard SSE, works with every OpenAI SDK. Usage is billed from upstream usage data (estimated from characters if upstream omits it).
stream = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[{"role": "user", "content": "..."}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")Standard OpenAI parameters pass through: temperature, top_p, max_tokens, stop, presence_penalty, frequency_penalty, seed, response_format (JSON mode), tools / tool_choice (function calling), stream_options (e.g. include_usage). Availability of advanced features depends on the selected model.
7. Tool calling & JSON mode
Function calling uses the standard OpenAI tools format and passes straight through — flagship Claude / GPT / Gemini models all support it. Only function tools are accepted; built-in tools such as web search or code execution, and the web_search_options parameter, are not supported.
resp = client.chat.completions.create(
model="claude-opus-4-8",
messages=[{"role": "user", "content": "What's the weather in Shanghai?"}],
tools=[{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather for a city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"],
},
},
}],
)
# model decides to call the tool:
print(resp.choices[0].message.tool_calls)Force JSON output with response_format={"type": "json_object"} (remember to also ask for JSON in the prompt).
8. PDF / document input
Workaround that does work: extract the text yourself (e.g. a PDF-to-text library) and send it as a plain text message — that's billed and processed normally like any other input.
9. Billing & credits
- Pay-per-token from your cocodot balance (Alipay / WeChat Pay (RMB), USDT / USDC top-up). No subscription.
- $0.5 bonus credit on email verification — API-only, usable after your first top-up. Trial credit unlocks budget models (Qwen / Haiku etc.); Opus / GPT / Gemini flagships need a wallet balance.
- Every call is itemized in Console → billing records (model / tokens / amount).
- Don't trust, verify — test any relay (including us) for model downgrading: probe.cocodot.co
10. Limits & errors
| Code | Meaning & fix |
|---|---|
| 401 | Invalid / missing API key — check the Bearer or x-api-key header. |
| 402 | No top-up yet, or balance too low for this call — top up in Console. Trial credit works after your first top-up. |
| 403 | ① Identity check not done yet → follow the link in the error message (about 1 minute, free); ② account unavailable → contact support; ③ Trial credit is limited to budget models (Qwen / Haiku). Once your wallet balance runs out, top up again to use Opus / GPT / Gemini. |
| 404 | Wrong path — most often a base_url mixup (see §2 warning). |
| 413 | Request body too large — limit 25 MB. |
| 400 | Bad request — unknown model ID, malformed body, or an unsupported tool type / parameter. |
| 5xx | Upstream hiccup — retry with backoff; contact support if persistent. |
12. Video generation API
Three video models behind one endpoint: Seedance 2.5 (billed per token), Kling v3 (per second), Hailuo 2.3 / 2.3-Fast (per clip). Async: submit, poll, download.
Authentication: API Key (Authorization: Bearer cocodot-…).
# ① Submit
curl -X POST https://cocodot.co/api/ai/video/generations \
-H "Authorization: Bearer cocodot-YOUR_API_KEY" -H "Content-Type: application/json" \
-d '{"model":"seedance-2.5","resolution":"480p","duration":5,
"content":[{"type":"text","text":"a cat by the window, slow push-in"}]}'
# → {"id":"...","status":"PENDING"}
# ② Poll until SUCCEEDED
curl https://cocodot.co/api/ai/video/generations/{id} \
-H "Authorization: Bearer cocodot-YOUR_API_KEY"
# → {"status":"SUCCEEDED","videoUrl":"...","usageTokens":38830}- Available models & verified parameter combos: GET /api/ai/video/models. Combinations whose upstream cost we have not verified are rejected at submit — the price you see is the price you pay.
- Billing settles only on success; failed generations cost nothing. An estimated amount is held at submission; the difference is refunded or charged based on actual usage at completion, and failures receive a full refund. Unit price is locked at submission.
- Requires real wallet balance — the $0.5 trial credit does not apply to video (a single clip exceeds a typical text call by orders of magnitude).
- The returned videoUrl is an upstream link with an expiry — download promptly.
- Reference prices: Hailuo 2.3-Fast 768p·6s ≈ ¥1.22/clip · Kling v3 std ¥0.57/s · Seedance: live prices at GET /api/ai/video/models. GET /api/ai/video/models
11. FAQ & support
Official-relay via licensed cloud vendors (not reverse-engineered). Verify it yourself anytime: downgrade test — open-source methodology.
Anything OpenAI-compatible: SillyTavern, Cursor, Cline, LangChain, LobeChat, NextChat… plus Claude Code via the Anthropic endpoint. See §5.
Requests are relayed for inference only; we don't train on your data.
In-console support, or see guides · Why trust us
Register, verify email for $0.5 bonus credit, add your real name, make your first top-up (unlocks the $0.5), create a key — a few minutes.
Get your API key →