Skip to main content
Call Fireworks from custom agents, background jobs, or services with curl, the OpenAI SDK, or the Anthropic SDK. Send requests to https://api.fireworks.ai/inference and use the same model ID across each supported wire API.

Compatible APIs

Choose the endpoint your SDK or client already uses: For client setup, see OpenAI compatibility, Anthropic compatibility, or the Responses API.

Call the API

Chat completions

Most direct API clients use chat completions:
If your account has an Anthropic Provider Key, that request can use Claude Opus. Otherwise, add -H "x-anthropic-api-key: $ANTHROPIC_API_KEY" to the request. To use Astra, set "model": "firerouter/astra" and connect an OpenAI Provider Key or send x-openai-api-key.

Messages (Anthropic-style)

Anthropic Messages clients use the same model id on /v1/messages:

Responses (OpenAI-style)

OpenAI Responses clients send input to /v1/responses:
Router IDs and provider credentials work the same way across all three APIs. If the account has no Anthropic Provider Key, add -H "x-anthropic-api-key: $ANTHROPIC_API_KEY".

Read the serving model

For a router request, the response model field identifies the model that served the request, such as glm-5p3, claude-opus-5-5, or gpt-6-astra. It does not repeat the router ID you sent. Easy prompts tend to stay on the open model. Harder prompts tend to use the family named in the router ID. Neither result is guaranteed for a single request. Continue sending the short router slug, such as firerouter/opus.

Credentials

A provider key in a request header applies only to that request. A key connected through Provider Keys is available at the account level, so clients and gateways do not need to send it with every call. Fireworks also accepts Anthropic credentials in x-api-key or Authorization: Bearer. One Authorization header cannot carry both the Fireworks and Anthropic keys. If it carries the Anthropic key, send the Fireworks key in X-Fireworks-Api-Key. Prefer x-anthropic-api-key for new integrations. For an OpenAI SDK pointed at Fireworks, api_key is the Fireworks key. Pass the OpenAI provider key as a header:
Drop default_headers when an OpenAI Provider Key is already connected.

Limitations

  • Accounts with data residency enabled must use a residency-compatible pinned serverless model. Other model-router requests are rejected.
  • Model routers are not available through Microsoft Foundry.

Errors

Model routers and deployment routers

A firerouter/... id is a model router. Routers load-balance traffic across your own Fireworks deployments.

See also