cocodot
cocodot Developer Docs

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

  1. 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).
  2. Create an API key in Console → AI.
  3. 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

PurposeEndpointAuth
Chat (OpenAI-compatible)POST /api/ai/v1/chat/completionsAuthorization: Bearer sk-…
Messages (Anthropic-compatible)POST /api/ai/v1/messagesx-api-key: sk-… or Bearer
Model dropdown (for clients)GET /api/ai/v1/modelsPublic
Full list + live pricesGET /api/ai/modelsPublic

Base URL for OpenAI SDKs / clients: https://cocodot.co/api/ai/v1 · For Anthropic SDK / Claude Code: https://cocodot.co/api/ai

The two base URLs differ by a trailing /v1 — OpenAI clients append /chat/completions, Anthropic clients append /v1/messages. If you get 404, check this first.

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 IDModel
claude-opus-5mco-7Claude Opus 5
claude-sonnet-5mcs-6Claude Sonnet 5
claude-opus-4-8mco-6Claude Opus 4.8
claude-sonnet-4-6mcs-5Claude Sonnet 4.6
claude-haiku-4-5mch-1Claude Haiku 4.5
claude-fable-5mcf-1Claude Fable 5
gpt-5.5mog-6GPT-5.5
gpt-5.4mog-3GPT-5.4
gemini-3.6-flashmgg-12Gemini 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

  1. API → Chat Completion, source: Custom (OpenAI-compatible)
  2. Custom endpoint (Base URL): https://cocodot.co/api/ai/v1 · API key: your sk-…
  3. Click Connect — the model dropdown auto-fills (via /v1/models). Pick e.g. claude-opus-4-8 and chat.

Cursor

  1. Settings → Models → API Keys: paste your sk-… into "OpenAI API Key"
  2. Enable "Override OpenAI Base URL": https://cocodot.co/api/ai/v1
  3. Add / tick the model names you want (claude-opus-4-8, gpt-5.5, …) and Verify.

Cline(VS Code)

  1. API Provider: "OpenAI Compatible"
  2. Base URL: https://cocodot.co/api/ai/v1 · API key: sk-…
  3. 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 usual

Model 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

PDF / document input is NOT currently supported. Sending a document content block doesn't error — the upstream silently drops the PDF bytes and the model responds as if no file was attached (confirmed: identical token count with or without the PDF). This isn't an endpoint mismatch or a bug on your end; it's a real upstream limitation, and we'd rather tell you than let you debug a phantom problem.

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

10. Limits & errors

CodeMeaning & fix
401Invalid / missing API key — check the Bearer or x-api-key header.
402No 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.
404Wrong path — most often a base_url mixup (see §2 warning).
413Request body too large — limit 25 MB.
400Bad request — unknown model ID, malformed body, or an unsupported tool type / parameter.
5xxUpstream 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}

11. FAQ & support

Is it the real model (no downgrading)?

Official-relay via licensed cloud vendors (not reverse-engineered). Verify it yourself anytime: downgrade test — open-source methodology.

Which clients are supported?

Anything OpenAI-compatible: SillyTavern, Cursor, Cline, LangChain, LobeChat, NextChat… plus Claude Code via the Anthropic endpoint. See §5.

Data privacy?

Requests are relayed for inference only; we don't train on your data.

Need help?

In-console support, or see guides · Why trust us

Ready to build?

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 →