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
| Protocol | Base URL | Your client adds |
|---|---|---|
| OpenAI-compatible | https://api.fluxrouter.ai/v1 | /chat/completions, /responses and so on |
| Anthropic-compatible | https://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
| Method | Path | Wire format | Purpose |
|---|---|---|---|
| POST | /v1/chat/completions | OpenAI Chat Completions | Primary chat endpoint |
| POST | /v1/responses | OpenAI Responses API | Responses-style requests |
| GET | /v1/models | OpenAI model list | The live list of flux-* ids |
| POST | /anthropic/v1/messages | Anthropic Messages | Anthropic-compatible chat |
| POST | /anthropic/v1/messages/count_tokens | Anthropic | Count tokens before sending |
Abilities
Each endpoint has its own reference page with every field, the response, the headers and the errors.
| Method | Path | Purpose | Status | Reference |
|---|---|---|---|---|
| POST | /v1/audio/transcriptions | Turn speech in an audio file into text. | Live | Speech to text |
| POST | /v1/audio/speech | Turn text into spoken audio. | Rolling out | Text to speech |
| GET | /v1/audio/voices | The voices your key can use. Not billed. | Live | Voice list |
| POST | /v1/images/generations | Make an image from a prompt. | Live | Images |
| POST | /v1/images/edits | Edit an image you send (multipart). | Live | Images |
| POST | /v1/search | Search the web and answer with sources. | Rolling out | Search |
| POST | /v1/fetch | Read a public web page as clean Markdown. | Live | Read a page |
| POST | /v1/decide (also /v1/systemone) | Typed questions about some text, answered with calibrated probabilities. | Paid plans only | Decision 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
| Path | Purpose | Status | Reference |
|---|---|---|---|
/mcp-tools/ | The Flux tools server: gives any MCP-capable agent the Flux abilities as tools, on your key. Keep the trailing slash. | Live | Tools server reference |
/mcp | The routing server: the flux_route, flux_explain and flux_models tools. | Live | Set 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:
| Endpoint | Streams? |
|---|---|
/v1/audio/speech | Always: the audio arrives in chunks as it is made. |
/v1/images/generations | With "stream": true: server-sent events with partial images, then the final one. |
/v1/audio/transcriptions | No. "stream": true is refused with 400. |
/v1/search, /v1/fetch, /v1/decide, /v1/images/edits, /v1/audio/voices | No. |
/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:
| Alias | Behaviour |
|---|---|
flux-auto | Flux picks among vetted models for each kind of task, cost-aware. The default. |
flux-fast | The Fast lane: lightweight, latency-sensitive work. |
flux-standard | The Standard lane: general-purpose work. |
flux-reasoning | The Reasoning lane: harder problems. |
flux-image | Image generation. The other image models are listed on Make and edit images. |
flux-voice | Speech to text. Picks the model by clip length. flux-voice-accurate and flux-voice-fast pin one. |
flux-voice-speak | Text to speech, the default. flux-voice-speak-hd is the higher-quality option. See Choose a voice. |
flux-decide | The 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
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:
| Header | Meaning |
|---|---|
X-Flux-Model | The model that actually served the request |
X-Flux-Original-Model | The model id you requested |
X-Flux-Routed | true or false: whether the router changed the model |
X-Flux-Request-Id | Unique request id for support and debugging |
X-Flux-Cost-Usd | What the request cost in USD (non-streaming responses only) |
X-Flux-Routed-Model | The concrete model that answered. Absent on a cache hit, where X-Flux-Cache: hit is sent instead |
X-Flux-Escalated | true only when a stronger model was brought in for this request; absent otherwise |
X-Flux-Billed-Lane | fast 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:
| Header | Meaning |
|---|---|
x-flux-routed-model | The model that served the call |
x-flux-billed-seconds | Seconds of audio billed (speech to text) |
x-flux-billed-chars | Characters billed (text to speech) |
x-flux-cost-usd | What the call cost in USD |
Errors
FluxRouter returns standard HTTP status codes with an OpenAI-compatible JSON error body. The common cases:
| Status | Meaning |
|---|---|
| 401 | Missing or invalid API key |
| 402 | A money check refused the request (balance, a cap you set, the Free monthly credit, or the account ceiling) |
| 429 | Rate limited, or the Free token allowance is used up |
| 5xx | Upstream 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.
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:
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:
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
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.