Skip to content

OpenAI-Compatible API ​

VLX FLUX provides an OpenAI-compatible API for customers who purchase distributed model access. In most SDKs, CLI tools, and third-party clients, you only need to replace the API key and Base URL.

Basic Settings ​

Use the following values when a tool asks for OpenAI-compatible API settings:

FieldValue
API KeyYour VLX FLUX API key
Base URLhttps://api.vlxflux.io/v1
AuthorizationBearer YOUR_API_KEY
ModelUse a model name available to your account

TIP

If a client asks for the full endpoint, use https://api.vlxflux.io/v1/chat/completions. If it asks for the Base URL, use only https://api.vlxflux.io/v1.

Request Headers ​

All HTTP requests should include the API key in the Authorization header:

http
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Do not include quotes around the API key. Do not add extra spaces before or after the key.

Common Endpoints ​

PurposeMethodPath
List modelsGET/models
Chat completionsPOST/chat/completions
Image generationPOST/images/generations

The full URL is created by combining the Base URL and request path.

Example:

text
https://api.vlxflux.io/v1/chat/completions

Test with curl ​

First, verify that your API key can access the model list:

bash
curl https://api.vlxflux.io/v1/models \
  -H "Authorization: Bearer YOUR_API_KEY"

Then send a minimal chat request:

bash
curl https://api.vlxflux.io/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      { "role": "user", "content": "Hello" }
    ]
  }'

Replace gpt-4o with a model name available to your account.

Python SDK ​

Install the OpenAI Python SDK:

bash
pip install openai

Call the API:

python
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.vlxflux.io/v1"
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "user", "content": "Hello"}
    ]
)

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

Node.js SDK ​

Install the OpenAI Node.js SDK:

bash
npm install openai

Call the API:

js
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.VLXFLUX_API_KEY,
  baseURL: "https://api.vlxflux.io/v1",
});

const response = await client.chat.completions.create({
  model: "gpt-4o",
  messages: [
    { role: "user", content: "Hello" },
  ],
});

console.log(response.choices[0].message.content);

Environment Variables ​

For local development, store your key in an environment variable instead of hard-coding it:

bash
export VLXFLUX_API_KEY="YOUR_API_KEY"
export VLXFLUX_BASE_URL="https://api.vlxflux.io/v1"

Some tools only recognize OpenAI-style variable names. In that case, use:

bash
export OPENAI_API_KEY="YOUR_API_KEY"
export OPENAI_BASE_URL="https://api.vlxflux.io/v1"

Model Names ​

Model names must match the models available to your API key. If a request returns model not found, first query the model list:

bash
curl https://api.vlxflux.io/v1/models \
  -H "Authorization: Bearer YOUR_API_KEY"

You can also check the model marketplace or dashboard for the latest model availability and pricing.

Billing ​

Requests are billed according to the selected model, your account balance, and the model group multiplier. The final pricing and availability are subject to the live dashboard.

For details, read Pricing and Model Groups.

Troubleshooting ​

  • 401 Unauthorized: Check whether the API key is correct and active.
  • 403 Forbidden: The key may not have access to the selected model or group.
  • 404 Not Found: Check whether the Base URL or request path is incorrect.
  • 429 Too Many Requests: Reduce request frequency or concurrency.
  • model not found: Use the model list endpoint to confirm the exact model name.
  • Insufficient balance: Recharge your account or switch to a lower-cost model.

For more details, read Error Codes and Troubleshooting.