Anthropic-compatible API: what it is and how to connect
What exactly has to match for a Claude client to work unchanged, and which abilities the format does not decide.
Definition
An Anthropic-compatible API is a service that accepts requests in the same shape Anthropic accepts and answers in the same format. The specifics have to match: the /v1/messages path, the x-api-key auth header, the mandatory anthropic-version, a body with model, max_tokens, messages and a separate system field, and a response with a content array of blocks plus a usage object.
The difference from the OpenAI format shows immediately: the system instruction is its own field rather than a message with the system role, the answer length limit is mandatory, and the answer arrives as blocks rather than one string.
Why it matters
- Tools written for Claude connect with no compatibility layer.
- The official Anthropic SDK works as-is — only the address and the key change.
- One key opens both the Anthropic and the OpenAI entry point: the format is your choice, not a plan.
- The model can be any one from the catalog, even if it is not made by Anthropic.
Code examples
import anthropic
client = anthropic.Anthropic(
base_url="https://api.tokenator.top/anthropic",
api_key="sk-your-tokenator-key",
)
msg = client.messages.create(
model="claude-opus-4-6",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)
print(msg.content[0].text)import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://api.tokenator.top/anthropic",
apiKey: "sk-your-tokenator-key",
});
const msg = await client.messages.create({
model: "claude-opus-4-6",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello" }],
});
console.log(msg.content[0].text);curl https://api.tokenator.top/anthropic/v1/messages \ -H "x-api-key: sk-your-tokenator-key" \ -H "anthropic-version: 2023-06-01" \ -H "Content-Type: application/json" \ -d '{"model":"claude-opus-4-6","max_tokens":1024,"messages":[{"role":"user","content":"Hello"}]}'
base_url includes the /anthropic prefix and the SDK appends /v1/messages to it. The max_tokens field is mandatory: without it the request is rejected.
What Tokenator supports
| Method | Path | Purpose |
|---|---|---|
| POST | /v1/chat/completions | The main OpenAI-format chat endpoint. Supports streaming, tools and multimodal input. |
| POST | /v1/responses | The Responses API format. Supports conversation continuation via previous_response_id. |
| POST | /v1/messages | The Anthropic Messages format. Also available under the /anthropic/v1/messages prefix. |
| POST | /v1/messages/count_tokens | Token counting for an Anthropic-format request. |
| POST | /v1/embeddings | Text embeddings. |
| POST | /v1/images/generations | Image generation. |
| POST | /v1/images/edits | Image editing and upscaling. Accepts multipart and JSON with base64. |
| POST | /v1/audio/speech | Speech synthesis. |
| POST | /v1/audio/transcriptions | Speech recognition. |
| POST | /v1/audio/translations | Recognition with translation into English. |
| GET | /v1/models | The list of models available to a given key. |
| GET | /v1/tokens | The key's remaining limit and spent tokens. |
The Anthropic entry point serves every model in the catalog, not just Claude. If a model is served by a non-Anthropic provider, the request is converted to that provider's format and the answer is converted back — your code never sees it. When the model is served by an Anthropic provider anyway, the request goes straight through with no conversion.
Streaming, tools and token counting work both ways: /v1/messages/count_tokens answers exactly as Anthropic does.
Where compatibility ends
The format is one thing, model abilities are another. Image input, tools and extended thinking depend on the specific model rather than the request format — a model's page in the catalog lists what it supports.
Differences from talking to Anthropic directly: client-side server tools for web search and web fetch are stripped from the request, and provider error texts are replaced with a generic message.
FAQ
How does the Anthropic format differ from the OpenAI one?
The system instruction is a separate system field rather than a message with the system role. max_tokens is mandatory. The answer comes as a content array of blocks instead of a string in choices[0].message.content.
Can I reach non-Anthropic models through this entry point?
Yes. Every model in the catalog is available: if a model is served by another provider, Tokenator converts the request and the answer for you.
Do I need a separate key for the Anthropic entry point?
No. The same key works for both entry points — only the address and how you pass it differ: x-api-key instead of Authorization: Bearer.
Does streaming work?
Yes, with "stream": true. Events arrive in the same shape Anthropic sends them, so your client-side parsing stays unchanged.