API reference

FluxRouter API reference: base URLs, authentication, every endpoint, model aliases, the models list, response headers, errors and quick raw HTTP requests.

FluxRouter is an OpenAI- and Anthropic-compatible gateway. Point an existing OpenAI or Anthropic client at the FluxRouter base URL with your Flux key, and it works. If you are connecting an agent rather than writing code, start at Connect your agent.

Base URLs

ProtocolBase URLYour client adds
OpenAI-compatiblehttps://api.fluxrouter.ai/v1/chat/completions, /responses and so on
Anthropic-compatiblehttps://api.fluxrouter.ai/anthropic/v1/messages

These are not interchangeable. Giving an Anthropic client the OpenAI base produces /v1/v1/messages, which returns 404.

Authentication

Pass your Flux API key (sk-...) as a bearer token on every request:

Authorization: Bearer sk-...

One key works across every endpoint and model. Keep it secret: it is tied to your account's billing and spend ceiling.

The Anthropic-compatible endpoint accepts the same key either way: Authorization: Bearer sk-... or the x-api-key: sk-... header the Anthropic SDKs send by default. The ability endpoints accept both too, except GET /v1/audio/voices and the MCP servers, which read only Authorization: Bearer.

If you limited a key to certain models, the ability endpoints check that list as well: add the ability's model names (such as flux-voice or flux-image) to the key, or its calls are refused with 401 or 403.

Endpoints

Models

MethodPathWire formatPurpose
POST/v1/chat/completionsOpenAI Chat CompletionsPrimary chat endpoint
POST/v1/responsesOpenAI Responses APIResponses-style requests
GET/v1/modelsOpenAI model listThe live list of flux-* ids
POST/anthropic/v1/messagesAnthropic MessagesAnthropic-compatible chat
POST/anthropic/v1/messages/count_tokensAnthropicCount tokens before sending

Abilities

Each endpoint has its own reference page with every field, the response, the headers and the errors.

MethodPathPurposeStatusReference
POST/v1/audio/transcriptionsTurn speech in an audio file into text.LiveSpeech to text
POST/v1/audio/speechTurn text into spoken audio.Rolling outText to speech
GET/v1/audio/voicesThe voices your key can use. Not billed.LiveVoice list
POST/v1/images/generationsMake an image from a prompt.LiveImages
POST/v1/images/editsEdit an image you send (multipart).LiveImages
POST/v1/searchSearch the web and answer with sources.Rolling outSearch
POST/v1/fetchRead a public web page as clean Markdown.LiveRead a page
POST/v1/decide (also /v1/systemone)Typed questions about some text, answered with calibrated probabilities.Paid plans onlyDecision mode

An ability endpoint that is not switched on for your account answers 404. The second opinion is not an endpoint: it is a flag on a flux-auto chat call. See Second opinion. Apps have no endpoint of their own: they are reached through the tools server. How to call each ability from an agent is under Give your agent abilities. Prices are on the pricing page; speech, transcription and image prices are also in the models list.

MCP

PathPurposeStatusReference
/mcp-tools/The Flux tools server: gives any MCP-capable agent the Flux abilities as tools, on your key. Keep the trailing slash.LiveTools server reference
/mcpThe routing server: the flux_route, flux_explain and flux_models tools.LiveSet up the tools server

Both authenticate with the same sk- key as a bearer token.

There is no bare /chat path. The Anthropic path serves only /anthropic/v1/messages and /anthropic/v1/messages/count_tokens; other Anthropic routes return 403. Send the anthropic-version header (default 2023-06-01); any anthropic-beta header you set is forwarded.

Streaming

Every chat endpoint streams. Set "stream": true in the request body to receive server-sent events; omit it (or set false) for a single JSON response. GET /v1/models and count_tokens are always non-streaming.

The ability endpoints differ:

EndpointStreams?
/v1/audio/speechAlways: the audio arrives in chunks as it is made.
/v1/images/generationsWith "stream": true: server-sent events with partial images, then the final one.
/v1/audio/transcriptionsNo. "stream": true is refused with 400.
/v1/search, /v1/fetch, /v1/decide, /v1/images/edits, /v1/audio/voicesNo.
/mcp-tools/Answers each tool call as a server-sent event stream, and keeps slow calls alive.

Model aliases

Set the model field to one of these:

AliasBehaviour
flux-autoFlux picks among vetted models for each kind of task, cost-aware. The default.
flux-fastThe Fast lane: lightweight, latency-sensitive work.
flux-standardThe Standard lane: general-purpose work.
flux-reasoningThe Reasoning lane: harder problems.
flux-imageImage generation. The other image models are listed on Make and edit images.
flux-voiceSpeech to text. Picks the model by clip length. flux-voice-accurate and flux-voice-fast pin one.
flux-voice-speakText to speech, the default. flux-voice-speak-hd is the higher-quality option. See Choose a voice.
flux-decideThe Flux decision model, for POST /v1/decide only. Paid plans. See Decision mode.
flux-pinned-*Pin one specific model, for example flux-pinned-claude-sonnet.

See Models for pinned ids and How routing works for how flux-auto decides.

Listing models

bash
curl https://api.fluxrouter.ai/v1/models \
  -H "Authorization: Bearer $FLUX_API_KEY"

GET /v1/models returns the live set of flux-* ids you can use in the model field. Use it instead of hard-coding a model list.

Response headers

Chat responses carry X-Flux-* headers so you can see what the router did:

HeaderMeaning
X-Flux-ModelThe model that actually served the request
X-Flux-Original-ModelThe model id you requested
X-Flux-Routedtrue or false: whether the router changed the model
X-Flux-Request-IdUnique request id for support and debugging
X-Flux-Cost-UsdWhat the request cost in USD (non-streaming responses only)
X-Flux-Routed-ModelThe concrete model that answered. Absent on a cache hit, where X-Flux-Cache: hit is sent instead
X-Flux-Escalatedtrue only when a stronger model was brought in for this request; absent otherwise
X-Flux-Billed-Lanefast or standard: the lane a flux-auto request was billed at. Only sent when lane billing is on

X-Flux-Original-Model is the alias you asked for, such as flux-auto; X-Flux-Routed-Model is the model that answered.

The model and lane headers above come back on non-streaming responses. A streamed response carries only X-Flux-Alias; the model that answered is in your Activity page.

On a streamed response the cost arrives in the final usage block instead. See Receipts.

Ability responses carry their own receipt headers:

HeaderMeaning
x-flux-routed-modelThe model that served the call
x-flux-billed-secondsSeconds of audio billed (speech to text)
x-flux-billed-charsCharacters billed (text to speech)
x-flux-cost-usdWhat the call cost in USD

Errors

FluxRouter returns standard HTTP status codes with an OpenAI-compatible JSON error body. The common cases:

StatusMeaning
401Missing or invalid API key
402A money check refused the request (balance, a cap you set, the Free monthly credit, or the account ceiling)
429Rate limited, or the Free token allowance is used up
5xxUpstream or gateway error; retry with backoff

Every 402 carries a machine-readable refusal code. The full list, where each code is carried, and how to handle it are in the chat error reference.

The ability endpoints and the MCP servers use a few other error shapes. Every shape and every ability code is in the error reference for every endpoint and tool.

Quick requests

The fastest way to check that a key works is a raw HTTP request: no SDK, no config file, just the base URL and a bearer token.

bash
curl https://api.fluxrouter.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-YOUR-FLUX-KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"flux-auto","messages":[{"role":"user","content":"hi"}]}'

A JSON response with a choices array means your key and endpoint are live, and the request shows in your dashboard.

Add "stream": true to get tokens as they arrive, as server-sent events:

bash
curl https://api.fluxrouter.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-YOUR-FLUX-KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"flux-auto","stream":true,"messages":[{"role":"user","content":"hi"}]}'

The same call on the Anthropic path:

bash
curl https://api.fluxrouter.ai/anthropic/v1/messages \
  -H "x-api-key: sk-YOUR-FLUX-KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model":"flux-auto","max_tokens":256,"messages":[{"role":"user","content":"hi"}]}'

Add -i to any of these to see the X-Flux-* response headers.

Drop-in with the OpenAI SDK

python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.fluxrouter.ai/v1",
    api_key="sk-...",
)

client.chat.completions.create(
    model="flux-auto",
    messages=[{"role": "user", "content": "Hello"}],
)

Because FluxRouter speaks the OpenAI and Anthropic wire formats, most tools that already talk to either work by changing only the base URL and the key.