Documentation
666 AI speaks three protocols. Whatever you already use will most likely work — change one address, paste one key, leave the rest alone.
YOUR-ENDPOINT in the examples below with your own endpoint — it is shown on your console home page, or let the setup guide generate the config for you.Quick start
From signup to a working request in about three minutes.
1. Get a key
Create one on the Keys page. Use a separate key per project and set a spend cap.
2. Set the address
https://YOUR-ENDPOINT/v1
3. Verify
curl https://YOUR-ENDPOINT/v1/chat/completions \ -H "Authorization: Bearer $KEY" \ -H "Content-Type: application/json" \ -d '{"model":"deepseek-v4-flash", "messages":[{"role":"user","content":"hi"}]}' # A JSON response means it works
Protocols
One key, one balance, three protocols. You don't need separate keys for different tools.
OpenAI format
The official openai library works as-is. Only base_url changes.
from openai import OpenAI client = OpenAI( api_key="YOUR_KEY", base_url="https://YOUR-ENDPOINT/v1" ) resp = client.chat.completions.create( model="deepseek-v4-flash", messages=[{"role": "user", "content": "你好"}] ) print(resp.choices[0].message.content)
import OpenAI from "openai"; const client = new OpenAI({ apiKey: "YOUR_KEY", baseURL: "https://YOUR-ENDPOINT/v1" }); const resp = await client.chat.completions.create({ model: "deepseek-v4-flash", messages: [{ role: "user", content: "你好" }] }); console.log(resp.choices[0].message.content);
Anthropic format
Using Claude Code or the Anthropic SDK? Use this format, no translation layer. Note this address does not include /v1.
# Add to ~/.zshrc or ~/.bashrc export ANTHROPIC_BASE_URL="https://YOUR-ENDPOINT" export ANTHROPIC_AUTH_TOKEN="YOUR_KEY" # Reopen the terminal, then just run claude
from anthropic import Anthropic client = Anthropic( api_key="YOUR_KEY", base_url="https://YOUR-ENDPOINT" ) msg = client.messages.create( model="claude-sonnet-5-5", max_tokens=1024, messages=[{"role": "user", "content": "你好"}] ) print(msg.content[0].text)
Gemini format
Coming soon. Until then, Gemini models work through the OpenAI format above with identical functionality.
# Call Gemini like this curl https://YOUR-ENDPOINT/v1/chat/completions \ -H "Authorization: Bearer $KEY" \ -H "Content-Type: application/json" \ -d '{"model":"gemini-3.5-flash","messages":[{"role":"user","content":"hi"}]}'
Editors & agents
Cursor
- Settings → Models → OpenAI API Key
- Turn on Override Base URL
- Enter the URL and key, hit Verify
Claude Code
- Set ANTHROPIC_BASE_URL
- Set ANTHROPIC_AUTH_TOKEN
- Reopen the terminal, run claude
Cline / Roo Code
- Provider: OpenAI Compatible
- Enter base URL and key
- Model ID from the catalog
Continue
- Edit config.json
- Set provider to openai
- Add the apiBase field
Apps & extensions
ChatBox / NextChat
- Choose OpenAI as provider
- Enter the gateway address
- Type the model name manually
Immersive Translate
- Add a custom AI service
- Endpoint /v1/chat/completions
- Pick a cheap fast model
Open WebUI
- Settings → Connections
- Add an OpenAI API connection
- Enter URL and key, save
Frameworks
Dify
- Provider: OpenAI-API-compatible
- Enter API endpoint and key
- Leave other nodes unchanged
n8n
- Create an OpenAI credential
- Set base URL to the gateway
- Select it in your node
LangChain
- Use ChatOpenAI
- Pass base_url
- Rest of the chain is unchanged
Streaming / tool calling / vision
These behave exactly as with the official APIs — no parameter changes. Support depends on the model; the catalog marks which.
stream = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[{"role":"user","content":"写一首诗"}],
stream=True
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")
Prompt caching
If every request carries the same long prefix — system prompt, project code, documents — the cached portion is billed at a steep discount. Coding and agent workloads benefit most.
Error codes
| Status | Meaning | What to do |
|---|---|---|
401 | Invalid or disabled key | Check the key was copied in full and still exists |
402 | Insufficient balance | Top up in the console |
404 | Model not found | Check the ID against the catalog |
429 | Too many requests | Lower concurrency or retry shortly |
500 | Upstream error | The gateway retries a backup route automatically. Contact us if it persists |
Quotas & limits
Every key can carry its own spend cap and model allowlist. Use one key per project — then any single leak has a fixed maximum loss and you just delete and recreate it.