API
Claude Code & Anthropic API
Besides the OpenAI-compatible API, we serve the native Anthropic Messages API at POST /v1/messages. Claude Code and the official Anthropic SDKs work by changing the base URL and key. Requests and responses pass through unchanged, including thinking, tool use, beta features and your own cache_control.
Claude Code
bash
export ANTHROPIC_BASE_URL=https://api.suanlimao.shop
export ANTHROPIC_API_KEY=sk-ait-...
# 让 Claude Code 使用本平台的模型 ID
export ANTHROPIC_MODEL=claude-sonnet-5-5
export ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-5-5
export ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-5-5
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-5-5
claudeAnthropic SDK
python
import anthropic
client = anthropic.Anthropic(base_url="https://api.suanlimao.shop", api_key="sk-ait-...")
msg = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)
print(msg.content[0].text)- Auth: x-api-key or Authorization: Bearer with your sk-ait- key.
- Claude models only; errors use the Anthropic shape { type: "error", error: { type, message } }.
- POST /v1/messages/count_tokens returns a local estimate and is free (60 per minute per key).
- Not supported (billed separately by the model vendor): server tools (web_search, web_fetch, code_execution), the MCP connector and the 1M-context beta (200k tokens per request).
Prompt caching
Requests from the same key stick to the same provider where possible, so prompt caches keep hitting. When you call Claude through the OpenAI-compatible API we add cache breakpoints on tools, the system prompt and the tail of multi-turn conversations. Cache read and write prices are listed per model on the model plaza, billed on the actual usage the model provider reports.