cocodot
cocodot Developer Docs

API Documentation

One key for Claude / GPT / Gemini / DeepSeek. OpenAI-compatible — change base_url and go. Anthropic-compatible endpoint for Claude Code & PDF input. 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-fable-5mcf-1Claude Fable 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
gemini-3.1-flash-litemgg-10Gemini 3.1 Flash-lite
deepseek-chatdeepseek-v4-flashDeepSeek V4 Flash
qwenqwen3.5-flashQwen3.5 Flash
qwen3.5-35b-a3bqwen3.5-35b-a3bQwen3.5 35B-A3B
qwen3.5-397b-a17bqwen3.5-397b-a17bQwen3.5 397B-A17B
qwen-plusqwen3.6-plusQwen3.6 Plus
glmglm-5.2GLM-5.2
glm-5.1glm-5.1GLM-5.1

Matching is by keyword — any name containing "opus" 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 →

🔥 Fable 5 (mcf-1) is Anthropic's newest flagship — direct access from China, no special params needed (we handle its zero-data-retention requirement automatically). · 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

Claude models can read PDFs directly — supported on the Anthropic-compatible /v1/messages endpoint via the document content block (base64).

PDF input works ONLY on /v1/messages (Anthropic format). The OpenAI-compatible /chat/completions endpoint silently ignores document blocks — if the model "can't see" your PDF, you are on the wrong endpoint.
import base64
from anthropic import Anthropic

client = Anthropic(base_url="https://cocodot.co/api/ai", api_key="sk-YOUR_KEY")
pdf_b64 = base64.b64encode(open("report.pdf", "rb").read()).decode()

msg = client.messages.create(
    model="claude-opus-4-8",
    max_tokens=2048,
    messages=[{
        "role": "user",
        "content": [
            {"type": "document", "source": {"type": "base64", "media_type": "application/pdf", "data": pdf_b64}},
            {"type": "text", "text": "Summarize this document"},
        ],
    }],
)
print(msg.content[0].text)

PDF pages are billed as input tokens (text + per-page image), same as Anthropic official. Request body limit 25 MB.

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 (DeepSeek / 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.

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