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 free credit.
  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
gpt-5.5mog-6GPT-5.5
gpt-5.4mog-3GPT-5.4
gemini-3.5-flashmgg-11Gemini 3.5 Flash

All available models (live)

Loading live model list…

Matching is by keyword — "opus-5" routes to Opus 5; a generic "opus" still routes to Opus 4.8, "sonnet" to Sonnet, "gpt" to GPT-5.5, etc. Unknown names pass through to upstream unchanged. Full live list & per-token prices: GET https://cocodot.co/api/ai/modelsPrice list →Cost calculator →

Claude Fable 5 (mcf-1) is currently out of stock upstream with no confirmed restock date. Claude Opus 5 (mco-7) — same list price as 4.8 with a 1M context window — is our recommended flagship in the meantime. · 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.

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.
402Insufficient balance — top up in Console.
403Trial credit is limited to budget models (Qwen / Haiku). Top up to unlock 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 or malformed body.
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.

# ① Submit
curl -X POST https://cocodot.co/api/ai/video/generations   -H "Authorization: Bearer YOUR_LOGIN_TOKEN" -H "Content-Type: application/json"   -d '{"model":"seedance-2.5","resolution":"480p",
       "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}
# → {"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 credit, create a key — 2 minutes.

Get your API key →
API Docs — cocodot · cocodot