curl

Call FluxRouter's OpenAI-compatible chat endpoint directly with curl.

The fastest way to confirm your Flux key works is a raw curl request. No SDK, no config file, just the base URL and a Bearer token.

Basic request

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"}]}'

Authentication is a Bearer token: Authorization: Bearer sk-.... The model alias flux-auto lets FluxRouter pick the model for you.

Streaming

Add "stream": true to get tokens as they arrive:

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 response comes back as server-sent events, one chunk per line.

Test it

Run the basic request. A JSON response with a choices array means your key and endpoint are live. Check your FluxRouter dashboard to see the request.