Quickstart
Make your first request in under a minute.
AI Models Router exposes one OpenAI-compatible endpoint for every model in the catalog. If your code already uses an OpenAI SDK, the migration is changing the base URL and the API key.
| Base URL | https://api.aimodelsrouter.ai/v1 |
|---|---|
| Auth | Authorization: Bearer sk-amr-v1-… |
| Endpoint | POST /chat/completions |
1. Create an API key
Sign up, add credits on the Credits page, then create a key on the API keys page. The full key is shown once; store it in an environment variable:
Shell
export AMR_API_KEY=sk-amr-v1-...2. Make a request
Pick a model slug from the model directory (format author/model) and send a chat completion:
from openai import OpenAI
client = OpenAI(
base_url="https://api.aimodelsrouter.ai/v1",
api_key="sk-amr-v1-...", # or os.environ["AMR_API_KEY"]
)
completion = client.chat.completions.create(
model="deepseek/deepseek-v4-flash",
messages=[{"role": "user", "content": "What is the meaning of life?"}],
)
print(completion.choices[0].message.content)3. Read the response
The response follows the OpenAI Chat Completions shape. The id is our generation id (gen-…), model is the slug you asked for, and usage.cost is the exact amount charged in USD.
Response (shape)
{
"id": "gen-3f1c9b8e0a2d4c55b6e7f8a9b0c1d2e3",
"object": "chat.completion",
"created": 1793050000,
"model": "deepseek/deepseek-v4-flash",
"choices": [{
"index": 0,
"message": { "role": "assistant", "content": "..." },
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 120,
"total_tokens": 134,
"cost": 0.000045
}
}Field values above illustrate the shape only. Your real cost is computed from the model's listed prices and the token counts of your request; see Billing & credits.
Next steps
- Stream responses token by token with server-sent events.
- Handle errors: every error has a stable
type. - Use your framework: Vercel AI SDK, LangChain and more via the base URL.