OpenAI-compatible API

An OpenAI-compatible API for every model in the catalogue

Keep the OpenAI SDK you already use. Change the base URL to LLMFlux and your existing Chat Completions and Responses code can call Claude, DeepSeek, Gemini, Grok, Qwen and the rest of the catalogue.

The change: base URL and key

Create a key in the LLMFlux dashboard, then pass https://api.llmflux.dev/v1 as the base URL. Requests are authenticated with Authorization: Bearer <key>, exactly as with OpenAI.

Python (openai)python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.llmflux.dev/v1",
    api_key="YOUR_LLMFLUX_API_KEY",
)

resp = client.chat.completions.create(
    model="claude-sonnet-5-5",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
Node.js (openai)ts
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.llmflux.dev/v1",
  apiKey: process.env.LLMFLUX_API_KEY,
});

const resp = await client.chat.completions.create({
  model: "claude-sonnet-5-5",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0].message.content);

Supported OpenAI-format endpoints

EndpointUse
POST /v1/chat/completionsChat messages in, a completion out. Supports stream: true.
POST /v1/responsesThe Responses API format, used by newer SDK helpers and agents such as Codex CLI.
GET /v1/modelsThe models your key can use, with their ids.
POST /v1/images/generationsImage generation, for models that support it.
GET /v1/usageAccount usage and remaining balance.

Streaming responses

Set stream: true and read server-sent events as usual; the gateway forwards chunks as soon as the provider sends them.

Node.js streamingts
const stream = await client.chat.completions.create({
  model: "claude-sonnet-5-5",
  messages: [{ role: "user", content: "Write a haiku about latency." }],
  stream: true,
});
for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}

Responses API

The Responses format works with the same client:

Python (openai) — Responsespython
resp = client.responses.create(
    model="claude-sonnet-5-5",
    input="Summarise the benefits of a unified AI API in two bullet points.",
)
print(resp.output_text)

Without an SDK

curlbash
curl https://api.llmflux.dev/v1/chat/completions \
  -H "Authorization: Bearer $LLMFLUX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5-5",
    "messages": [{ "role": "user", "content": "Explain what an API gateway does in one sentence." }]
  }'
  • Errors you already know

    Errors use the OpenAI-style envelope with type and code, for example invalid_model (404), rate_limit_exceeded (429) or quota_exhausted (402) when the credit balance runs out.

  • Tools that read OPENAI_BASE_URL

    Many frameworks honour OPENAI_BASE_URL and OPENAI_API_KEY environment variables; set them to LLMFlux values.

Prefer the Anthropic SDK or Claude Code? See the Anthropic-compatible API.

Documentation

Frequently asked questions

What does OpenAI-compatible mean?
It means the API accepts the same request and response shapes as OpenAI's API. Code written for the OpenAI SDK works against LLMFlux after you change the base URL and the API key.
Which OpenAI endpoints does LLMFlux support?
POST /v1/chat/completions, POST /v1/responses, GET /v1/models, and POST /v1/images/generations for image models. GET /v1/usage returns your account usage.
What base URL should I use?
Use https://api.llmflux.dev/v1 in the OpenAI SDKs. Some tools append /v1 themselves and need https://api.llmflux.dev instead; the docs list the exceptions.
Can I use non-OpenAI models with the OpenAI SDK?
Yes. Claude, DeepSeek, Gemini, Grok, Qwen and the other catalogue models are all called with the same Chat Completions request; only the model id changes.
Is LLMFlux affiliated with OpenAI?
No. LLMFlux is an independent gateway that implements OpenAI-compatible endpoints. OpenAI is a trademark of OpenAI.

Start with one key

Create an account, generate an API key, and send your first request in a few minutes.