First request
The primary endpoint for text and multimodal chat models is /v1/chat/completions. Use /v1/models to list available public model IDs.
https://api.wlrouter.com/v1/chat/completions
https://api.wlrouter.com/v1/models
Start with one API key, the OpenAI SDK you already use, and a model ID from the WLRouter catalog.
Create an API key in the console, set it as an environment variable, then send your first chat completion request.
Environment
export WLROUTER_API_KEY="wlrouter_..."curl https://api.wlrouter.com/v1/chat/completions \
-H "Authorization: Bearer $WLROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1-mini",
"stream": false,
"messages": [
{ "role": "user", "content": "Write a one sentence product summary." }
]
}'import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.WLROUTER_API_KEY,
baseURL: "https://api.wlrouter.com/v1"
});
const response = await client.chat.completions.create({
model: "gpt-4.1-mini",
stream: false,
messages: [{ role: "user", content: "Write a one sentence product summary." }]
});
console.log(response.choices[0]?.message?.content);from openai import OpenAI
client = OpenAI(
api_key=os.environ["WLROUTER_API_KEY"],
base_url="https://api.wlrouter.com/v1",
)
response = client.chat.completions.create(
model="gpt-4.1-mini",
stream=False,
messages=[{"role": "user", "content": "Write a one sentence product summary."}],
)
print(response.choices[0].message.content)The primary endpoint for text and multimodal chat models is /v1/chat/completions. Use /v1/models to list available public model IDs.
https://api.wlrouter.com/v1/chat/completions
https://api.wlrouter.com/v1/models
Use stream: true when your application should receive incremental deltas. Keep stream: false for a single JSON response.
curl https://api.wlrouter.com/v1/chat/completions \
-H "Authorization: Bearer $WLROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1-mini",
"stream": true,
"messages": [
{ "role": "user", "content": "Give me three launch checklist items." }
]
}'WLRouter uses USD prepaid balance. The minimum top-up is 10 USD and the service fee is 5%. Usage is deducted by model, input tokens, output tokens, and cache-read tokens where applicable.
Keep the returned request_id when contacting support. If the balance is too low, WLRouter returns an OpenAI-compatible error with code insufficient_balance.