Choose an accessible model
GET /v1/models with your RouterLab key lists the IDs available to your account. A public model page does not guarantee access on your plan. The trial is limited to models marked Trial.
Protocol · OpenAI-compatible
Keep the OpenAI request shape. Only the base URL, API key and model identifier change.
OpenAI compatibility lets you reuse SDKs and tools that accept a custom base URL.
Generate a key in the RouterLab dashboard and keep it server-side.
Call GET /v1/models to retrieve model identifiers that are actually available.
Configure your client to use https://api.routerlab.ch/v1.
Use the exact model identifier and the usual chat/completions format.
The same contract works over direct HTTP or with the OpenAI SDK.
cURL shell
curl https://api.routerlab.ch/v1/chat/completions \
-H "Authorization: Bearer $ROUTERLAB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"glm-5.3-flash-trial","max_tokens":128,"messages":[{"role":"user","content":"Hello RouterLab"}]}'Python · OpenAI SDK python
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["ROUTERLAB_API_KEY"],
base_url="https://api.routerlab.ch/v1",
)
response = client.chat.completions.create(
model="glm-5.3-flash-trial",
max_tokens=128,
messages=[{"role": "user", "content": "Hello RouterLab"}],
)
print(response.choices[0].message.content)TypeScript · OpenAI SDK typescript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.ROUTERLAB_API_KEY,
baseURL: "https://api.routerlab.ch/v1",
});
const response = await client.chat.completions.create({
model: "glm-5.3-flash-trial",
messages: [{ role: "user", content: "Hello" }],
});Start with a short request, check its response and usage, then add only the features published for the selected model.
GET /v1/models with your RouterLab key lists the IDs available to your account. A public model page does not guarantee access on your plan. The trial is limited to models marked Trial.
Use /v1 as the SDK base URL and an exact ID from /v1/models. This guide covers chat/completions; it does not imply support for every other SDK endpoint or parameter.
Check the model badges before adding tools or an output format. Your application executes tools and validates returned data. Support depends on the model and route.
Streaming requires the Streaming badge. An interrupted connection does not prove the call completed. On 429, distinguish a rate limit from an exhausted budget; do not automatically repeat a generation that already returned partial output.
Stream with the example model python
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["ROUTERLAB_API_KEY"], base_url="https://api.routerlab.ch/v1")
stream = client.chat.completions.create(
model="glm-5.3-flash-trial",
max_tokens=128,
messages=[{"role": "user", "content": "Hello RouterLab"}],
stream=True,
)
for part in stream:
if part.choices and part.choices[0].delta.content:
print(part.choices[0].delta.content, end="", flush=True)RouterLab normalizes access, but capabilities still depend on the selected model.
Messages, roles, streaming and tools follow the OpenAI contract when the route supports them.
The model field must contain an identifier returned by GET /v1/models.
Vision, tools, context and structured output are shown in the catalog.
You can change model families without changing SDK when the same route is available.
They are model families. Keep this integration and only change the model field. Always check route badges in the catalog.
Start by checking the key, model identifier and balance.
| HTTP | Likely cause | Action |
|---|---|---|
| 400 | Invalid body or unsupported parameter. | Compare the request with the chat/completions contract and model capabilities. |
| 401 | Missing, invalid or revoked key. | Check the Authorization header and regenerate the key if needed. |
| 404 | Unknown model identifier. | Read the list returned by GET /v1/models again. |
| 429 | Rate or available-credit limit reached. | Reduce request rate, then review limits in the dashboard. |
| 503 | Route temporarily unavailable. | Retry with backoff or select another compatible model. |
Use RouterLab’s second documented protocol instead of artificially adapting requests.
Read the Claude Messages guideAudience measurement
Allow Google Analytics and RouterLab to measure public visits and link campaign sources to your signup? This is optional and can be changed at any time. If you decline, only anonymous visit totals are kept.