Quickstart
Make your first request through the AllModels OpenAI-compatible LLM router.
AllModels is an OpenAI-compatible abliterated model router. Use one API key to call abliterated models through the OpenAI SDK, with automatic routing and provider failover.
Use the OpenAI SDK you already know
Set your OpenAI client's base URL to https://api.allmodels.io/oai and use your AllModels API key. The same client supports the Responses API and Chat Completions.
Before you start
You need an AllModels API key.
Install the OpenAI SDK
Install the OpenAI JavaScript SDK
npm install openaiConfigure the client
Configure the OpenAI JavaScript client
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_ALLMODELS_API_KEY",
baseURL: "https://api.allmodels.io/oai"
});Run LLM inference
Choose a model from the live LLM model catalog, then choose your language and the OpenAI API surface your application uses.
const response = await client.responses.create({
model: "YOUR_MODEL_ID",
input: "Explain model routing in one sentence."
});
console.log(response.output_text);const completion = await client.chat.completions.create({
model: "YOUR_MODEL_ID",
messages: [
{ role: "user", content: "Explain model routing in one sentence." }
]
});
console.log(completion.choices[0].message.content);The Responses API is stateless: send the complete conversation in each request rather than using stored conversations or previous_response_id. See Models to browse the live catalog and inspect model capabilities.
Choose a provider
Open the selected model in the LLM model catalog, copy one of its provider IDs, and add a provider object to either API surface.
const response = await client.responses.create({
model: "YOUR_MODEL_ID",
input: "Write a haiku about routing.",
provider: {
order: ["YOUR_PROVIDER_ID"]
}
});const completion = await client.chat.completions.create({
model: "YOUR_MODEL_ID",
messages: [{ role: "user", content: "Write a haiku about routing." }],
provider: {
order: ["YOUR_PROVIDER_ID"]
}
});See Providers for routing options and modality-aware provider selection, and Failover for what happens when a provider cannot serve a request.
Routes at a glance
| Route | Authentication | Purpose |
|---|---|---|
POST /oai/chat/completions | AllModels API key | OpenAI-compatible chat completion, JSON or streaming SSE |
POST /oai/responses | AllModels API key | Stateless Responses API, JSON or streaming events |
GET /oai/models | Public | OpenAI-format model catalog |
GET /oai/models/{model} | Public | One OpenAI-format model |
GET /or/models | Public | OpenRouter-format model catalog |
GET /or/models/{author}/{slug}/endpoints | Public | Providers, prices, limits, latency, and throughput for one model |
Troubleshooting
Errors use OpenAI's standard {"error": {...}} envelope.
| Status | Meaning |
|---|---|
400 | The request is invalid or uses a Responses feature the router does not support. |
401 | The AllModels API key is missing, unknown, or revoked. |
402 | The organization has no balance available or is blocked. |
404 | The model is not served, or provider preferences excluded every route. |
429 | Every eligible provider was rate-limited. |
502 | Every eligible provider failed or was unavailable. |
503 | No provider is currently available to serve the model. |
