Skip to main content
You can use the Anthropic Python SDK or Anthropic TypeScript SDK to interact with Fireworks. This makes migration of existing applications already using Anthropic’s Messages API particularly easy.

Specify endpoint and API key

Python

pip install anthropic
import os
import anthropic

client = anthropic.Anthropic(
    api_key=os.environ.get("FIREWORKS_API_KEY"),
    base_url="https://api.fireworks.ai/inference",
)

JavaScript / TypeScript

npm install @anthropic-ai/sdk
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: process.env.FIREWORKS_API_KEY,
  baseURL: "https://api.fireworks.ai/inference",
});

curl

curl https://api.fireworks.ai/inference/v1/messages \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $FIREWORKS_API_KEY" \
  -d '{
    "model": "accounts/fireworks/models/kimi-k2p5",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Say hello in Spanish"}
    ]
  }'
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. Just ensure that the model parameter refers to one of the Fireworks models. The Serverless Quickstart includes Anthropic SDK examples for all common use cases:

API compatibility

Supported endpoint

Fireworks supports the Anthropic /v1/messages endpoint, including both non-streaming and streaming (SSE) responses.

Deployment support

Anthropic compatibility is supported for both serverless and on-demand deployments. However, requests must go through api.fireworks.ai/inference — direct route endpoints are not supported.

Differences from Anthropic

The following parameters and fields are handled differently or are not supported:
  • model: Must be a Fireworks model identifier (e.g., accounts/fireworks/models/deepseek-v3p1) instead of an Anthropic model name. See the Fireworks Model Library for available models.
  • max_tokens: Optional on Fireworks (required on Anthropic).
  • anthropic-version header: Not required. Fireworks ignores this header.
  • usage field: Not included in the response Message object.
  • service_tier: Not supported. Removed from request parameters.
  • inference_geo: Not supported. Removed from request parameters.

Reasoning effort mapping

When using the thinking parameter with an effort level via output_config, the Anthropic effort values are mapped to Fireworks reasoning_effort:
Anthropic effortFireworks mapping
lowlow
mediummedium
highhigh
maxhigh
The adaptive thinking type is not yet supported.
For more details on reasoning with the Anthropic SDK, including interleaved thinking with tool use, see the Reasoning guide.

Unsupported features

The following Anthropic features are not available on Fireworks:
  • Server tools: bash, text_editor, and web_search server-side tools are not supported.
  • eager_input_streaming: Not supported on the Tool schema.
  • cache_control: Not supported on the Tool schema.
  • server_tool_use: Not included in usage tracking.

Fireworks extensions

The following Fireworks-specific extensions are available on the Anthropic-compatible endpoint:
  • raw_output: A request parameter (boolean) that, when set to true, returns low-level details of what the model sees in the response, including the formatted prompt and function calls. The response will include a raw_output object with prompt_fragments and other debugging information.

Next steps