API Docs

DUKOU AI provides an OpenAI-compatible API. Any OpenAI SDK, tool, or framework that supports a custom base URL can connect directly.

Quickstart

Create an API key in the console, then point your base URL at DUKOU AI:

https://api.dukou.ai/v1
Python (OpenAI SDK)
from openai import OpenAI

client = OpenAI(
    base_url="https://api.dukou.ai/v1",
    api_key="sk-dukou-********",  # created in the console
)

resp = client.chat.completions.create(
    model="deepseek-chat",
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
Node.js (OpenAI SDK)
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.dukou.ai/v1",
  apiKey: process.env.DUKOU_API_KEY,
});

const resp = await client.chat.completions.create({
  model: "gemini-3-flash",
  messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);
AI coding tools
# In Claude Code / Cursor / Cline and similar tools,
# point the OpenAI-compatible base URL and key at DUKOU AI:
export OPENAI_BASE_URL="https://api.dukou.ai/v1"
export OPENAI_API_KEY="sk-dukou-********"

Authentication

Every request carries the API key via Authorization: Bearer sk-dukou-.... A key is shown only once at creation, so store it safely; if it leaks, revoke it in the console immediately and create a new one (revocation takes effect network-wide within 30 seconds).

Endpoints

The following OpenAI-compatible endpoints are available at launch, with /v1/responses and /v1/embeddings coming later:

GET/v1/models
POST/v1/chat/completions
curl · list models
curl https://api.dukou.ai/v1/models \
  -H "Authorization: Bearer $DUKOU_API_KEY"
curl · chat completions
curl https://api.dukou.ai/v1/chat/completions \
  -H "Authorization: Bearer $DUKOU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.2",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Introduce yourself"}
    ]
  }'

Streaming

With "stream": true set, the response is returned incrementally as SSE (Server-Sent Events), matching the OpenAI streaming protocol.

curl · streaming
curl https://api.dukou.ai/v1/chat/completions \
  -H "Authorization: Bearer $DUKOU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "stream": true,
    "messages": [{"role": "user", "content": "Write a short poem about a ferry crossing"}]
  }'

Errors & billing

  • Error responses use the OpenAI-style error body: {"error": {"message", "type", "code"}}.
  • When a request starts, the maximum possible cost is reserved from your balance; when it ends, it settles on actual token usage and the difference is released. Insufficient balance returns a 4xx error.
  • Each request's model, token usage, cost, and latency can be looked up in the console's usage stats and ledger.