API Documentation

Fully OpenAI-compatible. Change one line to migrate existing code.

Base URL

https://joapiai.xin/v1

Authentication

Pass your API key in the Authorization header:

Authorization: Bearer sk-your-api-key

Available Models

Model ID Description Input Output Features
doubao-seed-2-0-mini Fast, low-latency, high-volume $0.14/M $0.69/M 🧠 🖼️ 🎬
doubao-seed-2-0-lite Balanced production flagship $0.39/M $1.99/M 🧠 🖼️ 🎬 ⭐
doubao-seed-2-0-code AI Coding Agent $1.49/M $6.99/M 🧠 💻 🖼️

🧠 Deep Thinking   🖼️ Image Understanding   🎬 Video Understanding   💻 Coding Enhanced

All models support 256k context window. View model comparison →

POST /v1/chat/completions

Fully compatible with OpenAI SDK. Supports streaming and non-streaming.

cURL

curl https://joapiai.xin/v1/chat/completions \
  -H "Authorization: Bearer sk-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seed-2-0-lite",
    "messages": [{"role": "user", "content": "Hello!"}],
    "stream": false
  }'

Python (openai SDK)

from openai import OpenAI

client = OpenAI(
    api_key="sk-your-key",
    base_url="https://joapiai.xin/v1"
)

# Non-streaming
resp = client.chat.completions.create(
    model="doubao-seed-2-0-lite",
    messages=[{"role": "user", "content": "Write a haiku about the ocean"}]
)
print(resp.choices[0].message.content)

# Streaming
for chunk in client.chat.completions.create(
    model="doubao-seed-2-0-mini",
    messages=[{"role": "user", "content": "Count to 5"}],
    stream=True
):
    print(chunk.choices[0].delta.content or "", end="", flush=True)

🧠 reasoning_effort — Deep Thinking Control

All Doubao Seed 2.0 models support 4 thinking levels. Thinking is disabled by default.

minimal
No thinking, fastest
low
Light reasoning
medium
Balanced (recommended)
high
Deep reasoning, best quality
resp = client.chat.completions.create(
    model="doubao-seed-2-0-lite",
    messages=[{"role": "user", "content": "Solve: 3x + 5 = 20"}],
    extra_body={"reasoning_effort": "medium"}   # minimal | low | medium | high
)
print(resp.choices[0].message.content)

Note: thinking tokens are included in output token billing.

🖼️ Image / Video Understanding

Pass image_url in the messages content array. Format is identical to OpenAI Vision API.

resp = client.chat.completions.create(
    model="doubao-seed-2-0-lite",
    messages=[{
        "role": "user",
        "content": [
            {"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}},
            {"type": "text",      "text": "What is in this image?"}
        ]
    }]
)
print(resp.choices[0].message.content)

💻 Use with Claude Code / Cursor / Cline

doubao-seed-2-0-code is a drop-in replacement for Claude Sonnet in AI coding tools, at half the price.

Claude Code

# ~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "sk-your-joapi-key",
    "ANTHROPIC_BASE_URL": "https://joapiai.xin/v1",
    "ANTHROPIC_MODEL": "doubao-seed-2-0-code"
  }
}

Cursor / Cline / OpenAI-compatible tools

Base URL : https://joapiai.xin/v1
API Key  : sk-your-joapi-key
Model    : doubao-seed-2-0-code

GET /v1/models

curl https://joapiai.xin/v1/models \
  -H "Authorization: Bearer sk-your-key"

Error Codes

CodeMeaning
401Invalid or missing API key
402Insufficient balance — please top up
429Rate limit exceeded (10s/IP) or monthly quota reached
451Content policy violation — logged
400Bad request (unknown model, invalid params)
502Upstream API error