Anthropic-compatible Messages
When to use this page
Use this page when your client expects the Anthropic Messages API shape.
Base URL
https://api.quotaflow.ai
Endpoint
POST https://api.quotaflow.ai/v1/messages
Muse on Messages
Keys with Muse access can send meta/muse-* models using the Messages shape. These are Muse models, not Claude models; the Claude-line rules below do not define their capabilities. Discover Muse with GET /openai/v1/models, not the Claude-only GET /v1/models. Muse is not supported on /v1/messages/count_tokens. See the Muse API quickstart for a complete request and compatibility notes.
Supported models
Your API key decides your Claude line. Each Claude key is assigned exactly one line, and the line decides the model-id prefix the key uses, the response identity it receives, and the supply that serves it. You cannot switch lines by changing the prefix: send the prefix of your key's line, or the bare id.
| Your key's line | Prefix to send | Response identity |
|---|---|---|
| Anthropic | anthropic/claude-* | Anthropic: msg_01... message ids, toolu_01... client-tool ids |
| Anthropic Enterprise | anthropic-enterprise/claude-* | Anthropic: msg_01... message ids, toolu_01... client-tool ids |
| AWS Bedrock | aws-bedrock/claude-* | AWS Bedrock: msg_bdrk_... message ids, toolu_bdrk_... client-tool ids |
| AWS Bedrock Enterprise | aws-bedrock-enterprise/claude-* | AWS Bedrock: msg_bdrk_... message ids, toolu_bdrk_... client-tool ids |
| Claude Code | anthropic/claude-* (this line has no prefix of its own) | Anthropic: msg_01... message ids, toolu_01... client-tool ids |
To see the exact ids your key may send, call GET /v1/models (or GET /openai/v1/models) with that key. Authenticated model discovery lists only your key's line, so the ids it returns are the ids to use. A request that spells another line's prefix is refused with 403; a prefix that is not one of the prefixes above, such as a misspelling, is refused as an unknown model with 404, whose message tells you to call GET /v1/models for the models the key can request.
A bare id such as claude-opus-4-8 is accepted on every key and follows the key's line. On an AWS Bedrock Enterprise key, the aws-bedrock/claude-* spelling also stays accepted and is served on the key's own enterprise line, because that was the line's spelling before it had its own prefix; model discovery lists only the aws-bedrock-enterprise/claude-* ids.
All Claude lines use the same key-scoped, capability-verified scheduling rules. The anthropic/ and aws-bedrock/ lines share one managed supply pool, where the assigned prefix controls the customer-visible response contract and not the upstream vendor selected for a request. The anthropic-enterprise/ and aws-bedrock-enterprise/ lines are served only by the enterprise supply assigned to them, and that supply serves no other line; the one exception is Quotaflow's own first-party supply, which can serve the enterprise lines while still serving the others. An enterprise line has platform fallback only when that first-party supply is assigned to it. The response model is the bare canonical Claude id without the routing prefix. For every completed message, Quotaflow generates the public message id before the first response byte from that selected customer projection; it is opaque and does not reveal or preserve an upstream message id. Except for a server-side fallback request described below, an internal fallback cannot change the requested public model or add fallback narration. Message ids remain opaque on every request. Tool definitions and tool_use_id result references are projected together so their relationship remains intact. Documented cache and thinking-token details are retained when supplied with valid public values; Anthropic-only service_tier and inference_geo fields are omitted from the AWS Bedrock projection. Provider headers, hosts, account metadata, route details, and upstream request ids are not exposed on any projection. The request and event schema at /v1/messages remains Anthropic-compatible on every line.
Server-side fallback (Anthropic line only)
On the Anthropic line, Messages accepts fallbacks with anthropic-beta: server-side-fallback-2026-07-01 (a list or "default") or server-side-fallback-2026-06-01 (a list only), exactly as the Claude API does. It is not offered on the Claude Code, Enterprise or AWS Bedrock lines. Without the beta header, or under any other server-side-fallback-* date, fallbacks is refused with a 400 (fallbacks: Extra inputs are not permitted); the beta header alone changes nothing.
{
"model": "claude-opus-5-5",
"max_tokens": 2048,
"fallbacks": [{ "model": "claude-opus-4-8" }],
"messages": [{ "role": "user", "content": "Explain HTTP caching headers." }]
}
A list names up to three canonical, unprefixed model ids, tried in order, each different from the requested model and from each other, and each a permitted fallback target of the requested model (Claude Fable 5.2, 5.1 and 5 and Claude Opus 5.5: claude-opus-4-8, claude-opus-5; Claude Opus 5: claude-opus-4-8; Claude Sonnet 5.5: claude-sonnet-5). Claude Haiku 5.5 has no server-side fallback: a list is refused with a 400. An entry may override max_tokens, thinking and output_config for its attempt; speed is not offered on this line. Every named model must be available to your key. A fallback model may also be written with your key's line prefix (anthropic/claude-opus-4-8); it is matched, and named in fallback blocks, usage.iterations and model, by its bare id.
Only a classifier refusal (stop_reason: "refusal") triggers a fallback; a rate limit, overload or server error on the requested model is returned as it is. When the requested model declines before any output, the next listed model runs the same request in the same call. The response then looks like the Claude API's: the serving model in model, a fallback block at each boundary (from, to, trigger), and usage.iterations with a message entry for each declined attempt and a fallback_message entry for the one that answered. Top-level usage describes the attempt that answered, not a sum. A streamed response opens (message_start) on the model that serves, with the fallback block as its first content block, so its time to first byte includes the declined attempt.
Quotaflow runs the chain on the same supplier account as the requested model. When a fallback model is rate limited or overloaded, or that account does not serve it, the fallback attempt is not made and the requested model's refusal is returned with stop_details.recommended_model naming the model to retry directly (null for any other failure). A streamed refusal that arrives after output was already delivered is returned as that refusal, with recommended_model naming the next listed model (null when a tool-use block was the last one opened); a non-streaming request in the same case omits the declined partial output and answers fresh on the fallback model, as the Claude API does.
"fallbacks": "default" is accepted under the 2026-07-01 date, but Anthropic does not publish its default routing, so Quotaflow does not run it: a refusal stands, with recommended_model: null.
When the requested model answers a request sent with the beta (a list, "default", or fallback blocks in the history), usage.iterations holds one message entry with model: null and that answer's own token counts, as the Claude API reports it; on a stream it is on the final message_delta only, and message_start carries no iterations.
Each attempt is billed at its own model's rate and your terms, once. A refusal before any output is free unless its stop_details.category is bio, frontier_llm or reasoning_extraction; an attempt that produced output is billed even when its partial output is omitted. The charge is the sum of the billable attempts and never adds the top-level usage again. Fallback credit is not applied, so a fallback attempt writes its own model's prompt cache. No extra balance is reserved for the chain.
On the next turn, keep fallback blocks where you received them and send the beta header with them: without it the request is refused with a 400 naming the block (Input tag 'fallback' found using 'type' does not match any of the expected tags), as the Claude API does. Quotaflow removes them before a supplier that does not run the chain itself, as Anthropic's SDK refusal-fallback middleware does. There is no sticky routing: a later turn tries the requested model again.
External fallback_credit_token redemption is not supported. Credit tokens and claims are not exposed as redeemable response values.
Enterprise lines
Each enterprise prefix selects a separate supply line while keeping the documented response identity of its base line:
anthropic-enterprise/claude-*uses the Anthropic identity projection (msg_01...).aws-bedrock-enterprise/claude-*uses the AWS Bedrock identity projection (msg_bdrk_...), with the same AWS Bedrock error vocabulary and request adaptations asaws-bedrock/.
The response contract, message-id shape, and provider-metadata sanitization of an enterprise line are identical to its base line, and the request must still match your key's line: an anthropic-enterprise key may send anthropic-enterprise/claude-*, an aws-bedrock-enterprise key may send aws-bedrock-enterprise/claude-*, and a key on any other line is refused either enterprise prefix.
Availability is evaluated per key and request shape, so /models is authoritative.
Claude model ids by line
The table shows every line's public id for each reviewed model. A single key's /models returns only its own line's column.
| Model | Anthropic | Anthropic Enterprise | AWS Bedrock | AWS Bedrock Enterprise |
|---|---|---|---|---|
| Fable 5 | anthropic/claude-fable-5 | anthropic-enterprise/claude-fable-5 | aws-bedrock/claude-fable-5 | aws-bedrock-enterprise/claude-fable-5 |
| Fable 5.1 | anthropic/claude-fable-5.1 | anthropic-enterprise/claude-fable-5.1 | aws-bedrock/claude-fable-5.1 | aws-bedrock-enterprise/claude-fable-5.1 |
| Fable 5.2 | anthropic/claude-fable-5.2 | anthropic-enterprise/claude-fable-5.2 | aws-bedrock/claude-fable-5.2 | aws-bedrock-enterprise/claude-fable-5.2 |
| Sonnet 5.5 | anthropic/claude-sonnet-5.5 | anthropic-enterprise/claude-sonnet-5.5 | aws-bedrock/claude-sonnet-5.5 | aws-bedrock-enterprise/claude-sonnet-5.5 |
| Sonnet 5 | anthropic/claude-sonnet-5 | anthropic-enterprise/claude-sonnet-5 | aws-bedrock/claude-sonnet-5 | aws-bedrock-enterprise/claude-sonnet-5 |
| Opus 5.5 | anthropic/claude-opus-5.5 | anthropic-enterprise/claude-opus-5.5 | aws-bedrock/claude-opus-5.5 | aws-bedrock-enterprise/claude-opus-5.5 |
| Opus 5 | anthropic/claude-opus-5 | anthropic-enterprise/claude-opus-5 | aws-bedrock/claude-opus-5 | aws-bedrock-enterprise/claude-opus-5 |
| Opus 4.8 | anthropic/claude-opus-4.8 | anthropic-enterprise/claude-opus-4.8 | aws-bedrock/claude-opus-4.8 | aws-bedrock-enterprise/claude-opus-4.8 |
| Opus 4.7 | anthropic/claude-opus-4.7 | anthropic-enterprise/claude-opus-4.7 | aws-bedrock/claude-opus-4.7 | aws-bedrock-enterprise/claude-opus-4.7 |
| Opus 4.6 | anthropic/claude-opus-4.6 | anthropic-enterprise/claude-opus-4.6 | aws-bedrock/claude-opus-4.6 | aws-bedrock-enterprise/claude-opus-4.6 |
| Opus 4.5 | anthropic/claude-opus-4.5 | anthropic-enterprise/claude-opus-4.5 | aws-bedrock/claude-opus-4.5 | aws-bedrock-enterprise/claude-opus-4.5 |
| Sonnet 4.6 | anthropic/claude-sonnet-4.6 | anthropic-enterprise/claude-sonnet-4.6 | aws-bedrock/claude-sonnet-4.6 | aws-bedrock-enterprise/claude-sonnet-4.6 |
| Sonnet 4.5 | anthropic/claude-sonnet-4.5 | anthropic-enterprise/claude-sonnet-4.5 | aws-bedrock/claude-sonnet-4.5 | aws-bedrock-enterprise/claude-sonnet-4.5 |
| Haiku 5.5 | anthropic/claude-haiku-5.5 | anthropic-enterprise/claude-haiku-5.5 | aws-bedrock/claude-haiku-5.5 | aws-bedrock-enterprise/claude-haiku-5.5 |
| Haiku 4.5 | anthropic/claude-haiku-4.5 | anthropic-enterprise/claude-haiku-4.5 | aws-bedrock/claude-haiku-4.5 | aws-bedrock-enterprise/claude-haiku-4.5 |
Legacy unprefixed Claude ids remain accepted during migration and follow the key's line, but new integrations should use the prefixed ids returned by /models.
Extended thinking
Use the same Anthropic-compatible request fields your client already sends.
| Model | Recommended thinking shape |
|---|---|
claude-sonnet-5 | thinking: { "type": "adaptive" }; omit manual budget_tokens |
claude-opus-4-8 | thinking: { "type": "adaptive" } |
claude-opus-4-7 | thinking: { "type": "adaptive" } |
claude-opus-4-6 | thinking: { "type": "adaptive" } or legacy manual thinking |
claude-sonnet-4-6 | thinking: { "type": "adaptive" } or legacy manual thinking |
claude-sonnet-4-5 | Standard Anthropic-compatible thinking fields when enabled for your key |
claude-opus-4-5-20251101 | Standard Anthropic-compatible thinking fields when enabled for your key |
For claude-sonnet-5, claude-opus-4-8, and claude-opus-4-7, adaptive thinking is the supported mode. Send thinking: { "type": "adaptive" } or omit the field to use the model default. Do not send legacy thinking: { "type": "enabled", "budget_tokens": ... } or thinking: { "type": "disabled" } for adaptive-only Claude models; Quotaflow rejects those request shapes with a customer-terminal 400. Streaming responses preserve the Anthropic-compatible SSE event shape.
Route-aware request transport
Quotaflow owns the provider transport selected by your key and model namespace. You do not need to add anthropic-version to a Quotaflow request. Anthropic SDKs may still send anthropic-version: 2023-06-01; it is accepted as compatibility metadata, while Quotaflow constructs the actual provider request itself.
For anthropic/*, send beta opt-ins in the native anthropic-beta header. For aws-bedrock/* and aws-bedrock-enterprise/*, Quotaflow also accepts the Bedrock InvokeModel body forms "anthropic_version": "bedrock-2023-05-31" and "anthropic_beta": ["..."]. Those body fields are optional at the Quotaflow gateway. If present, the version must use the Bedrock value; body and header beta tokens are merged and deduplicated before dispatch. Bedrock body transport fields are not reinterpreted on an anthropic/* route. The selected customer namespace controls this adaptation even when the managed supplier pool contains different Claude resource origins.
The retired context-1m-* token is accepted for client compatibility but is not forwarded upstream and does not select or purchase a 1M context service. New integrations should remove that retired token. The effective context limit is determined by the requested model, request size, and availability for your key; Quotaflow never silently substitutes a smaller context tier because of this header.
Sampling controls on adaptive-only Claude models
For claude-sonnet-5, claude-opus-4-8, and claude-opus-4-7, do not send non-default temperature, top_p, or top_k. Those models use adaptive behavior instead of explicit sampling controls. Quotaflow strips those fields where possible before forwarding, but clients should omit them to match the model contract. Use prompting plus thinking: { "type": "adaptive" } for depth control.
Output configuration
Top-level output_config is an accepted request field. Quotaflow recognizes output_config.format.type=json_schema as a structured-output request and routes it only to supply with positive capability evidence. Other output_config members, including effort, remain provider-defined passthrough fields, except that on a new conversation, or on a later turn that moves to another serving route, when the service is under pressure, effort may be sent one level lower and may then be kept at that level for that conversation; enterprise lines are never changed. An admitted field is forwarded; support is still model- and customer-line-specific, so an unsupported combination returns a customer-terminal 400 in the selected anthropic/* or aws-bedrock/* error vocabulary. In particular, AWS documents structured output for supported Claude models through Bedrock Runtime InvokeModel/Converse, not the Bedrock Anthropic Messages endpoint.
Streaming usage
Keep the usage reported in message_start and apply the cumulative usage in
message_delta. The opening output count is not the final output count, and
an opening zero is not proof that the request was free. Track
input_tokens, cache_creation_input_tokens, cache_read_input_tokens, and
output_tokens separately.
A stream is complete only after message_stop. If the connection closes
inside a content block, its tool input and final usage may be incomplete.
Do not treat that interruption as a successful, zero-cost response. An
estimated usage record in the console is distinct from an upstream-reported
final reading; a disconnected client cannot receive a final frame afterward.
Errors and request IDs
Non-streaming errors use the Anthropic-compatible envelope. The request-id response header and body request_id contain the same neutral Quotaflow gateway identifier on both projections. Quotaflow does not synthesize an AWS infrastructure request id:
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "Invalid request"
},
"request_id": "req_..."
}
Quotaflow returns the standard error types for their matching HTTP status: invalid_request_error (400 and other unmapped 4xx), authentication_error (401), billing_error (402), permission_error (403), not_found_error (404), conflict_error (409), request_too_large (413), rate_limit_error (429), api_error (500-class service failures), timeout_error (504), and overloaded_error (529). Internal route, account, provider, credential, and upstream transport classifications are never returned as error types.
A request containing an empty text block ({"type":"text","text":""}) may return 400 with messages: text content blocks must be non-empty. Remove empty text blocks from the message history while preserving tool calls and their matching tool results. This specific validation message is preserved in both HTTP errors and terminal streaming error events.
One api_error names its cause. When a request asked for manual thinking (thinking.type: "enabled") and every model answer Quotaflow received was an empty thinking block with no answer text, Quotaflow refuses to deliver that answer, charges nothing, and returns 500 api_error with the message The model returned an empty thinking block and no answer text, and no usable answer was produced; nothing was charged for this request. Retrying later, or without manual thinking, is the usual remedy.
After a streaming response has started, an error is emitted as an Anthropic-compatible SSE event. Its data contains only the documented type and error fields; use the neutral request-id header for gateway correlation.
event: error
data: {"type":"error","error":{"type":"api_error","message":"The service is temporarily unavailable. Please try again later."}}
Fast mode routing
Send the optional X-QuotaFlow-Routing: fast header to start a new conversation on the capacity predicted to give the first answer soonest, choosing the most economical option among those within 15 % of the fastest. It changes routing order only: the model, every request parameter, the response and the price are unchanged, the header is never forwarded upstream, later turns of a conversation stay where their prompt cache is, and any other value is ignored. See Fast mode routing.
Curl
curl https://api.quotaflow.ai/v1/messages \
-H "x-api-key: $QUOTAFLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-5",
"max_tokens": 128,
"messages": [
{ "role": "user", "content": "Return only: connected" }
]
}'
Adaptive thinking curl
curl https://api.quotaflow.ai/v1/messages \
-H "x-api-key: $QUOTAFLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-opus-4.8",
"max_tokens": 1024,
"thinking": { "type": "adaptive" },
"messages": [
{ "role": "user", "content": "Solve this carefully, then give the final answer." }
]
}'
SDK environment pattern
export ANTHROPIC_AUTH_TOKEN="$QUOTAFLOW_API_KEY"
export ANTHROPIC_BASE_URL="https://api.quotaflow.ai"
Quotaflow preserves the Anthropic-compatible request and response shape for downstream clients.
Streaming content blocks
Process content blocks by their event indexes, not by assuming the first block
is always meaningful text. Compatible streaming clients may receive a separate
whitespace-only text block while an answer is opening. This is not part of a
tool argument or structured text result. Use the first non-whitespace answer
content to measure meaningful response latency, and retain the upstream usage
values when accounting for tokens.