Get your key
Sign up, get your key, connect your agent and give it a first ability. A few minutes, start to finish.
This page gets your agent working through Flux. For most agents the whole change is two settings: the base URL and the key.
1. Get your key
- Sign up at /auth/sign-up.
- Your account starts on the Free plan, with $1 of credit and a default key made for you automatically. The Free plan explains what it covers and where it stops.
- Copy your key. A key's full value is shown once, when it is created. If you did not copy it, create a new one on Keys. It looks like
sk-....
Keep the key somewhere safe. Many agents read it from an environment variable:
export FLUX_API_KEY="sk-..."
When you want more than the Free plan covers, move to pay as you go or a plan. See Plans.
2. Connect your agent
Pick your agent. Each page has the exact config: base URL, key and model.
And anything else with an OpenAI or Anthropic endpoint:
- Any OpenAI-compatible tool, if your tool asks for a base URL and a key.
- Any Anthropic-compatible tool, if your tool speaks Anthropic Messages.
- A custom endpoint, for tools with a custom provider block, or your own code.
More tools have guides in Connect your agent. The two base URLs are:
| Protocol | Base URL |
|---|---|
| OpenAI-compatible | https://api.fluxrouter.ai/v1 |
| Anthropic-compatible | https://api.fluxrouter.ai/anthropic (no /v1 on the end) |
Set the model to flux-auto and Flux picks among vetted models for each kind of task, cost-aware. Let Flux pick, or pin a model covers the other choices.
If the agent will not connect, see My agent won't connect.
3. Give it a first ability
Add the Flux tools server to your agent, with the same key, and it can read web pages and make images as tools. See Set up the Flux tools server.
Check it from the command line
To confirm the key works outside your agent, send one request:
curl https://api.fluxrouter.ai/v1/chat/completions \
-H "Authorization: Bearer $FLUX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-auto",
"messages": [
{ "role": "user", "content": "Say hello from Flux." }
]
}'
A JSON response with a completion means your key works.
Using an SDK in your own code
You do not switch libraries. Keep your OpenAI or Anthropic SDK and change the base URL to Flux.
OpenAI Python SDK
from openai import OpenAI
client = OpenAI(
api_key="sk-...", # your Flux key
base_url="https://api.fluxrouter.ai/v1", # the one line you change
)
response = client.chat.completions.create(
model="flux-auto",
messages=[{"role": "user", "content": "Say hello from Flux."}],
)
print(response.choices[0].message.content)
OpenAI Node SDK
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.FLUX_API_KEY, // your Flux key
baseURL: "https://api.fluxrouter.ai/v1", // the one line you change
});
const response = await client.chat.completions.create({
model: "flux-auto",
messages: [{ role: "user", content: "Say hello from Flux." }],
});
console.log(response.choices[0].message.content);
Anthropic Python SDK
from anthropic import Anthropic
client = Anthropic(
api_key="sk-...", # your Flux key
base_url="https://api.fluxrouter.ai/anthropic", # the one line you change
)
message = client.messages.create(
model="flux-auto",
max_tokens=1024,
messages=[{"role": "user", "content": "Say hello from Flux."}],
)
print(message.content[0].text)
Anthropic Node SDK
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: process.env.FLUX_API_KEY, // your Flux key
baseURL: "https://api.fluxrouter.ai/anthropic", // the one line you change
});
const message = await client.messages.create({
model: "flux-auto",
max_tokens: 1024,
messages: [{ role: "user", content: "Say hello from Flux." }],
});
console.log(message.content[0].text);