OpenAI SDK

Point the OpenAI Python or Node SDK at FluxRouter by changing the base URL.

If your code already uses the OpenAI SDK, switching to FluxRouter is a one-line change: set the base URL and use your Flux key.

Python

python
from openai import OpenAI

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

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

Or set OPENAI_BASE_URL and OPENAI_API_KEY in your environment instead of passing them inline.

Node

js
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.fluxrouter.ai/v1",
  apiKey: "sk-YOUR-FLUX-KEY",
});

const resp = await client.chat.completions.create({
  model: "flux-auto",
  messages: [{ role: "user", content: "hi" }],
});

Note the casing: Node uses baseURL, Python uses base_url.

Test it

Run the snippet above. If you get a completion back, your traffic is flowing through FluxRouter. Check your dashboard to confirm the request landed.