Skip to content
FluxCDNFluxCDN
esc
On this page

DocsAPI for developers

Quickstart

Three things change: the base URL, the key, and the model string. Everything else in your existing OpenAI-compatible code stays as it is.

import os

from openai import OpenAI

client = OpenAI(
    base_url="https://ai.fluxcdn.cloud/api/v1",
    api_key=os.environ["FLUXCDN_API_KEY"],
)

resp = client.chat.completions.create(
    model="router/auto",
    messages=[{"role": "user", "content": "Hello"}],
)

print(resp.choices[0].message.content)

Use your key in Claude Code, Codex, Cursor and other tools: Tools guide →

Authentication

Keys are issued by FluxCDN and scoped to one project. Send them as a bearer token. We store a hash, so a key is displayed in full exactly once at creation.
HTTP
Authorization: Bearer flux_live_YOUR_KEY

Per-key limits cover allowed models, RPM, TPM, concurrency, daily and monthly budget, and an optional IP allowlist.

Models

List what your key can reach, with live pricing and capability metadata. The catalog is stable across provider changes.
GET /v1/models
{
  "data": [
    {
      "id": "anthropic/claude-sonnet-4.5",
      "object": "model",
      "context_window": 200000,
      "max_output_tokens": 64000,
      "capabilities": ["text", "vision", "tools", "json", "reasoning"],
      "pricing": { "input_per_mtok": "3.0000", "output_per_mtok": "15.0000", "unit": "token" },
      "status": "healthy"
    }
  ]
}

Chat completions

OpenAI-compatible request and response shapes, including streaming, tool calls, and structured output. Response headers tell you which endpoint actually served the call and what it cost.
POST /v1/chat/completions
{
  "model": "router/auto",
  "messages": [{"role": "user", "content": "Summarise this ticket"}],
  "stream": true
}

Routing controls

Name a model and let the router choose the endpoint, or constrain it. Anything you set per request is intersected with your organization policy, and the stricter value wins.
router/autoBest quality-per-dollar for the detected task.
router/fastLowest time to first token among healthy endpoints.
router/cheapLowest total cost that still meets the capability requirements.
vendor/modelA specific model, with the endpoint still chosen by health and price.

Routing controls →

Error contract

Provider errors are normalized to one shape and one set of types, so your retry logic does not need a branch per vendor.
JSON
{
  "error": {
    "type": "upstream_unavailable",
    "message": "All endpoints for this model are unavailable.",
    "request_id": "req_8Kd2Qm",
    "retryable": true,
    "attempts": 3
  }
}

API reference →