Suanlimao

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
claude

Anthropic 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)

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.