Anthropic provider summary
Bifrost supports Anthropic models through OpenAI-compatible APIs and Anthropic-compatible passthrough routes.
Common Anthropic model IDs used in Bifrost routes:
claude-opus-4-6(claude-opus-4-6-20260205)claude-sonnet-4-5(claude-sonnet-4-5-20250929)claude-opus-4-5(claude-opus-4-5-20251101)claude-3-7-sonnet(claude-3-7-sonnet-20250219)claude-3-haiku(claude-3-haiku-20240307)
| Property | Details |
|---|---|
| Description | Claude is Anthropic's model family for reasoning, coding, and language tasks. |
| Provider route on Bifrost | anthropic/<model> |
| Provider doc | Anthropic |
| API endpoint for provider | https://api.anthropic.com |
| Supported endpoints | /v1/chat/completions, /v1/responses, /v1/complete, /v1/files, /v1/messages/batches, /v1/models, /anthropic/v1/messages (passthrough) |
Supported OpenAI parameters
Quick list of OpenAI-style parameters accepted while targeting Anthropic through Bifrost.
[ "stream", "stop", "temperature", "top_p", "max_tokens", "max_completion_tokens", "tools", "tool_choice", "response_format", "user", "reasoning", "top_k" ]
Use as a Claude Code backend
Claude Code can use Bifrost as an Anthropic-compatible backend by pointing ANTHROPIC_BASE_URL to Bifrost's Anthropic endpoint. This is a common setup for routing Claude traffic through governance, logs, and fallback.
# Point Claude Code to Bifrost's Anthropic-compatible endpoint export ANTHROPIC_BASE_URL="http://localhost:8080/anthropic" # Use your Bifrost virtual key (or provider key depending on setup) export ANTHROPIC_API_KEY="vk_your_key" # Launch Claude Code claude
For full walkthrough and troubleshooting, see Claude Code gateway setup.
Supported operations
Anthropic has different payload structures than OpenAI. Bifrost translates requests and responses so your existing OpenAI-style clients can still work. Embeddings, Speech, Transcriptions, and Image Generation are not supported by the upstream Anthropic API. These return UnsupportedOperationError.
| Operation | Non-streaming | Streaming | Upstream endpoint |
|---|---|---|---|
| Chat Completions | Yes | Yes | /v1/messages |
| Responses API | Yes | Yes | /v1/messages |
| Text Completions | Yes | No | /v1/complete |
| Embeddings | No | No | - |
| Speech (TTS) | No | No | - |
| Transcriptions (STT) | No | No | - |
| Image Generation | No | No | - |
| Files | Yes | - | /v1/files |
| Batch | Yes | - | /v1/messages/batches |
| List Models | Yes | - | /v1/models |
Beta headers
Bifrost automatically manages Anthropic beta headers by detecting required headers from request features and injecting them. Headers are validated per provider to prevent unsupported headers from reaching the upstream API. Passthrough headers are forwarded when set manually via the anthropic-beta request header.
| Beta header | Anthropic | Azure | Vertex | Bedrock | Auto-injected |
|---|---|---|---|---|---|
| computer-use-2025-01-24 / computer-use-2025-11-24 | Yes | Yes | Yes | Yes | Yes (tool type detection) |
| structured-outputs-2025-11-13 | Yes | Yes | No | Yes | Yes (strict/output_format) |
| advanced-tool-use-2025-11-20 | Yes | Yes | No | No | Yes (defer_loading/input_examples/allowed_callers) |
| mcp-client-2025-11-20 | Yes | Yes | No | No | Yes (mcp_servers detection) |
| prompt-caching-scope-2026-01-05 | Yes | Yes | No | No | Yes (cache_control.scope) |
| compact-2026-01-12 | Yes | Yes | Yes | Yes | Yes (compaction edit) |
| context-management-2025-06-27 | Yes | Yes | Yes | Yes | Yes (clear edits) |
| files-api-2025-04-14 | Yes | Yes | No | No | Yes (files endpoint) |
| interleaved-thinking-2025-05-14 | Yes | Yes | Yes | Yes | Yes (thinking enabled/adaptive) |
| skills-2025-10-02 | Yes | Yes | No | No | Passthrough |
| context-1m-2025-08-07 | Yes | Yes | Yes | Yes | Passthrough |
| fast-mode-2026-02-01 | Yes | No | No | No | Yes (speed=fast) |
| redact-thinking-2026-02-12 | Yes | Yes | No | No | Passthrough |
API reference by operation
Gateway paths and upstream Anthropic endpoints, aligned with the Bifrost Anthropic provider docs.
1) Chat Completions
Primary request path. Maps to upstream /v1/messages. Use extra_params or pass Anthropic-specific fields (for example top_k) directly in the request body.
curl -X POST http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-3-5-sonnet",
"messages": [{"role": "user", "content": "Hello"}],
"top_k": 40
}'2) Responses API
Uses the same underlying /v1/messages endpoint. Converts between OpenAI's Responses format and Anthropic's Messages format. Supports function, computer_use_preview, web_search, and mcp tool types.
curl -X POST http://localhost:8080/v1/responses \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-3-5-sonnet",
"input": "Hello, how are you?",
"top_k": 40
}'3) Text Completions (legacy)
Legacy API using upstream /v1/complete. Streaming is not supported. The prompt is auto-wrapped with \n\nHuman: {prompt}\n\nAssistant:; max_tokens maps to max_tokens_to_sample.
4) Batch API
Request formats: requests array (CustomID + Params) or input_file_id. Cursor-based pagination with after_id, before_id, limit. Response is JSONL with {custom_id, result: {type, message}}.
Upstream endpoints:
POST /v1/messages/batches: CreateGET /v1/messages/batches: ListGET /v1/messages/batches/{batch_id}: RetrievePOST /v1/messages/batches/{batch_id}/cancel: Cancel
5) Files API
Requires beta header anthropic-beta: files-api-2025-04-14 (auto-injected by Bifrost on files endpoints). Upload uses multipart/form-data with file (required) and filename (optional). Field mapping: size_bytes → bytes, mime_type → content_type. File purpose is always "batch"; status is always "processed".
curl -X POST http://localhost:8080/v1/files \ -F "file=@document.pdf"
Gateway endpoints:
POST /v1/filesGET /v1/files(cursor pagination)GET /v1/files/{file_id}DELETE /v1/files/{file_id}GET /v1/files/{file_id}/content
6) List Models
GET /v1/models?limit={defaultPageSize} with no body. Field mapping: id (prefixed anthropic/), display_name → name, created_at (Unix timestamp). Token-based pagination with NextPageToken, FirstID, LastID. Multi-key setups aggregate results and filter by allowed_models when configured.
curl http://localhost:8080/v1/models
Prompt caching (Anthropic)
Add cache directives to system messages, user messages, and tool definitions. Bifrost also forwards a top-level cache_control object on /anthropic/v1/messages requests unchanged.
| Where to apply cache_control | Value | Use case |
|---|---|---|
| System content blocks | { "type": "ephemeral" } | Large static instructions and policies |
| User message content blocks | { "type": "ephemeral" } | Repeated context blobs (docs/logs/code) |
| Tool definitions | { "type": "ephemeral" } | Stable tool schemas reused across requests |
Caching example
curl -X POST http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-3-5-sonnet",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "This is cached context",
"cache_control": {"type": "ephemeral"}
}
]
}
],
"system": [
{
"type": "text",
"text": "You are a helpful assistant",
"cache_control": {"type": "ephemeral"}
}
]
}'Reasoning / thinking
reasoning.effort maps to thinking.type (always "enabled"). reasoning.max_tokens maps to thinking.budget_tokens. Minimum budget is 1024 tokens; -1 is converted to 1024 automatically.
// Request
{"reasoning": {"effort": "high", "max_tokens": 2048}}
// Anthropic conversion
{"thinking": {"type": "enabled", "budget_tokens": 2048}}Dropped parameters
The following OpenAI-style parameters are silently ignored when targeting Anthropic through Bifrost:
[ "frequency_penalty", "presence_penalty", "logit_bias", "logprobs", "top_logprobs", "seed", "parallel_tool_calls", "service_tier" ]
Supported Claude models
Use the provider prefix anthropic/ in Bifrost model routes for deterministic provider targeting.
| Family | Model ID | Bifrost route | Typical usage |
|---|---|---|---|
| Claude Opus 4.6 | claude-opus-4-6-20260205 | anthropic/claude-opus-4-6-20260205 | Reasoning-heavy tasks |
| Claude Sonnet 4.5 | claude-sonnet-4-5-20250929 | anthropic/claude-sonnet-4-5-20250929 | General production default |
| Claude Opus 4.5 | claude-opus-4-5-20251101 | anthropic/claude-opus-4-5-20251101 | High-depth analysis |
| Claude Opus 4.1 | claude-opus-4-1-20250805 | anthropic/claude-opus-4-1-20250805 | High-quality legacy ops |
| Claude 3.7 Sonnet | claude-3-7-sonnet-20250219 | anthropic/claude-3-7-sonnet-20250219 | Thinking-enabled workflows |
| Claude 3.5 Sonnet | claude-3-5-sonnet-20240620 | anthropic/claude-3-5-sonnet-20240620 | Stable broad compatibility |
| Claude 3 Haiku | claude-3-haiku-20240307 | anthropic/claude-3-haiku-20240307 | Fast + lower-cost responses |
Core request mapping
Bifrost normalizes OpenAI-format input to Anthropic-format fields. This is the key layer that enables compatibility without changing client code.
| OpenAI-style param | Anthropic conversion | Notes |
|---|---|---|
| max_completion_tokens | max_tokens | Renamed for Anthropic Messages API |
| temperature, top_p | Direct pass-through | |
| stop | stop_sequences | Supports array values |
| response_format | output_format | Structured outputs conversion |
| tools | name + input_schema | function.name → name; function.parameters → input_schema; strict dropped |
| tool_choice | Type mapped | "auto" → auto | "none" → none | "required" → any | specific tool → {"type":"tool","name":"X"} |
| reasoning | thinking | reasoning.effort → thinking.type (enabled); max_tokens → budget_tokens (min 1024) |
| user | metadata.user_id | User identifier wrapped in metadata |
| top_k | Via extra_params | Anthropic-specific; pass in body or extra_params |
Implementation caveats
| Caveat | Impact | Severity |
|---|---|---|
| System message extraction | System messages removed from array, placed in separate system field | High |
| Tool message grouping | Consecutive tool messages merged into single user message | High |
| Minimum reasoning budget | reasoning.max_tokens must be >= 1024 or request fails | High |
| Dynamic budget conversion | reasoning.max_tokens = -1 converted to 1024 | Medium |
| Strict tool mode dropped | strict: true in tool definitions silently dropped | Medium |
| Arguments serialization | Tool call input (object) serialized to arguments (JSON string) | Low |
Response conversion
Key field mappings on the way back to OpenAI-compatible responses:
stop_reason→finish_reason(end_turn/stop_sequence→stop,max_tokens→length,tool_use→tool_calls)- Cache token counts roll into
prompt_tokenswith breakdown inprompt_tokens_details thinkingblocks →reasoning_details- Streaming:
message_start→content_block_delta→message_stop
Anthropic passthrough
Send native Anthropic Messages API payloads to /anthropic/v1/messages when you need full control over Anthropic request shapes.
curl -X POST http://localhost:8080/anthropic/v1/messages \
-H "Content-Type: application/json" \
-H "x-bf-vk: vk_your_key" \
-d '{
"model": "claude-sonnet-4-5-20250929",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "What changed between versions?"}]
}'Authoritative references
- Bifrost Anthropic provider reference: docs.getbifrost.ai/providers/supported-providers/anthropic
- Anthropic platform docs: docs.anthropic.com/en/docs/build-with-claude/overview
- Bifrost provider support overview: docs.getbifrost.ai/providers/supported-providers/overview