Chat
Anthropic Messages and Claude Code
Claude models also speak Anthropic’s Messages API, so Anthropic’s SDKs, Claude Code and anything built for them work with a new base URL and key.
/v1/messagesBase URL https://api.zurelay.com (the SDKs add /v1/messages). Send the key as x-api-key or Authorization: Bearer, with anthropic-version: 2023-06-01. Only Claude models are served here; other models use /v1/chat/completions.
With Anthropic’s SDKs
import osimport anthropicclient = anthropic.Anthropic( base_url="https://api.zurelay.com", api_key=os.environ["ZURELAY_API_KEY"],)message = client.messages.create( model="claude-opus-5-5", max_tokens=1024, system="You are a careful code reviewer.", messages=[{"role": "user", "content": "Review this function: def add(a, b): return a - b"}],)print(message.content[0].text)Everything in Anthropic’s Messages API passes through (except metadata, which stays with us): system as a string or blocks (with cache_control for prompt caching), tools, thinking, output_config, stop_sequences, temperature, streaming with the same events, and anthropic-beta headers. Images and PDFs go in as image and document blocks: see Images, PDFs, audio and video. Anthropic refuses temperature, top_p and top_k on Claude from Opus 4.7 on, so for those models we leave them out of the request instead of failing it.
Thinking
Claude thinks adaptively: it decides how much a request needs, and output_config.effort sets how hard it works: low, medium, high, xhigh (extra high) or max. Add display: "summarized" to thinking to get a summary of the thinking back in thinking blocks.
import osimport anthropicclient = anthropic.Anthropic( base_url="https://api.zurelay.com", api_key=os.environ["ZURELAY_API_KEY"],)message = client.messages.create( model="claude-opus-5-5", max_tokens=32000, thinking={"type": "adaptive", "display": "summarized"}, output_config={"effort": "xhigh"}, messages=[{"role": "user", "content": "How many primes are there below 1,000?"}],)for block in message.content: print(block.thinking if block.type == "thinking" else block.text)- Claude Opus 5.5 and the Fable models always think: Opus 5.5 at
mediumunless you set a level, Fable athigh. Asked not to think, they run atlow. - Claude Sonnet 5.5 and Opus 5 think at
highby default, and Claude Haiku 5.5 atmedium. Opus 4.6 to 4.8 think only when you sendthinking. Opus 4.6 has noxhigh, so it runs athigh. - The older form,
thinking: { type: "enabled", budget_tokens }, works on every Claude model: those that refuse it think adaptively at the closest level instead. Claude Haiku 4.5 takes only that form, and gets a budget when you send adaptive thinking. - Thinking is billed as output tokens, so leave room for it in
max_tokensatxhighandmax, and stream long answers. When you set a level, thex-zurelay-reasoning-effortheader says which one ran.
Prompt caching
Caching works as it does with Anthropic: put cache_control on the blocks to cache, or on the whole request, to keep them for five minutes, or add "ttl": "1h" to keep them for an hour. Each part of the input is billed the way Anthropic bills it:
The two kinds of writes are in usage.cache_creation, and cache_creation_input_tokens is both together. Each model page shows its cache prices. Only what you ask to cache is billed as a write: a request without cache_control pays the input price for everything it doesn’t read from the cache, and input you asked to keep for five minutes is never billed as an hour’s.
Claude Code
Point Claude Code at Zurelay with five environment variables (the base URL, your key and the three model aliases), then run it as usual:
export ANTHROPIC_BASE_URL="https://api.zurelay.com"export ANTHROPIC_AUTH_TOKEN="$ZURELAY_API_KEY"export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-5-5"export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-5-5"export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-5-5"claudeTo keep it, put the same values in the env block of ~/.claude/settings.json. The full guide, and guides for Cursor, Cline and others, are under Integrations.
Claude Code’s /effort levels reach the model as output_config.effort, so xhigh and max work as they do with Anthropic. Ultracode is a Claude Code setting, not an effort level: it runs at the session’s level (xhigh when you start Claude Code with --effort ultracode).
Counting tokens
/v1/messages/count_tokensTakes the same body as /v1/messages and returns { "input_tokens": 1234 }, an estimate of what the request would count. Free.
Errors
Errors come back in Anthropic’s shape ({ "type": "error", "error": { "type", "message" } }), with the same meanings as on the errors page. They carry no code: use the HTTP status and error.type.
/v1/chat/completions. Send one to /v1/messages and the error says which endpoint to use. The table on Images, PDFs, audio and video shows what each model reads.- Tip: Anthropic’s token counter and ours can differ slightly; usage in the response is what’s billed.
Questions, or something missing? Ask our support team and we’ll answer by email, usually within a minute.