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:
| Field | Value |
|---|---|
| API Key | Your VLX FLUX API key |
| Base URL | https://api.vlxflux.io/v1 |
| Authorization | Bearer YOUR_API_KEY |
| Model | Use 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:
Authorization: Bearer YOUR_API_KEY
Content-Type: application/jsonDo not include quotes around the API key. Do not add extra spaces before or after the key.
Common Endpoints
| Purpose | Method | Path |
|---|---|---|
| List models | GET | /models |
| Chat completions | POST | /chat/completions |
| Image generation | POST | /images/generations |
The full URL is created by combining the Base URL and request path.
Example:
https://api.vlxflux.io/v1/chat/completionsTest with curl
First, verify that your API key can access the model list:
curl https://api.vlxflux.io/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"Then send a minimal chat request:
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:
pip install openaiCall the API:
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:
npm install openaiCall the API:
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:
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:
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:
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.