POST /v1/messages.
Quickstart
Install the Anthropic SDK for your language:- Python
- JavaScript / TypeScript
The base URL for the Anthropic SDK is
https://api.fireworks.ai/inference (without the /v1 suffix). The SDK appends /v1/messages automatically.Usage
Use the Anthropic SDK as you normally would. Setmodel to a Fireworks model resource name, such as accounts/fireworks/models/kimi-k2p5.
The Serverless Quickstart includes Anthropic SDK examples for common use cases:
API compatibility
Supported endpoint
Fireworks supports the Anthropic/v1/messages endpoint, including non-streaming and streaming (SSE) responses.
Deployment support
Anthropic compatibility is supported for serverless and on-demand deployments. Requests must go throughapi.fireworks.ai/inference (direct route endpoints are not supported for this surface).
Differences from Anthropic
The following parameters and fields are handled differently or are not supported:model: Must be a Fireworks model identifier (for example,accounts/fireworks/models/deepseek-v3p2) instead of an Anthropic model name. See the Fireworks Model Library for available models.max_tokens: Optional on Fireworks (required on Anthropic).anthropic-versionheader: Not required. Fireworks ignores this header.usagefield: Included in both non-streaming and streaming responses. See Token usage for details.service_tier: Not supported.inference_geo: Not supported.
Reasoning effort mapping
When you use thethinking parameter with output_config.effort, Anthropic effort values map to Fireworks reasoning_effort:
| Anthropic effort | Fireworks mapping |
|---|---|
low | low |
medium | medium |
high | high |
max | high |
The
adaptive thinking type is not supported yet.Unsupported features
The following Anthropic features are not available on Fireworks:- Server tools: Server-side tool families (for example, code execution, memory, web fetch, tool search, and web search) are not supported.
- Server-tool metadata: Fields such as
callerandcontainerare not supported. - Tool schema fields:
eager_input_streaming,cache_control,allowed_callers,defer_loading, andinput_examplesare not supported. server_tool_use: Not included in usage tracking.speed: Theoutput_config.speedoption is not supported yet.
Fireworks extensions
The following Fireworks-specific extension is available on the Anthropic-compatible endpoint:raw_output: A request parameter (boolean) that returns low-level details of what the model sees, including formatted prompts and function call data.
Token usage
Token usage (input_tokens and output_tokens) is included in both non-streaming and streaming responses.
Non-streaming
For non-streaming requests, usage is returned on the response object:Streaming
For streaming requests, token usage is included in the finalmessage_delta event:
There is only one
message_delta event per stream (the last event before message_stop), and it always contains the actual token counts. The message_start event also includes a usage field, but its values are always 0 and should be ignored for metering purposes.