Skip to navigation

Quickstart

View as Markdown

Make your first OpenModels request in a few minutes. OpenModels uses an OpenAI-compatible API, so most existing OpenAI SDK code works after you change the base URL and API key.

1. Create an API key

Open the OpenModels dashboard, go to API Keys, and create a key. Keys use the ale-... format and are shown once.

  • Store the key in a secrets manager or environment variable.
  • Do not commit API keys to source control.
  • Use separate keys for development, staging, and production.
  • Rotate a key immediately if it may have leaked.
export OM_API_KEY="ale-your-api-key"

2. Add credits

Open Credits and add balance before routing production traffic. Credits are shared across supported models and API keys.

  • Use one-time top-ups for manual funding.
  • Use card payments or supported crypto payment methods where available.
  • Enable auto top-up when you want balance to refill automatically below your threshold.
  • Credits are consumed according to the selected route’s pricing unit.

3. Choose a model

Open Models and copy a model ID. The model ID is the value you pass in the model field.

For testing, start with a low-cost chat model such as qwen3.5-flash, then switch models by changing only the model value.

The examples below include optional route and route_mode fields. Replace the provider placeholder with a route name from the Models table or OpenModels dashboard, or remove both fields to use the default available route.

After the first request works, create a Model Route if you want application code to call a stable route ID such as route:coding-agent.

4. Send a request

Base URL:

https://api.getopenmodels.com/v1

Endpoint:

POST /chat/completions

cURL

curl https://api.getopenmodels.com/v1/chat/completions \
-H "Authorization: Bearer $OM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.5-flash",
"route": { "provider": "<provider-for-this-model>" },
"route_mode": "balanced",
"messages": [
{
"role": "user",
"content": "Hello! Give me a one-sentence explanation of OpenModels."
}
],
"max_tokens": 256
}'

Python

import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.getopenmodels.com/v1",
api_key=os.environ["OM_API_KEY"],
)
response = client.chat.completions.create(
model="qwen3.5-flash",
messages=[
{
"role": "user",
"content": "Hello! Give me a one-sentence explanation of OpenModels.",
}
],
max_tokens=256,
extra_body={
"route": {"provider": "<provider-for-this-model>"},
"route_mode": "balanced",
},
)
print(response.choices[0].message.content)

Node.js

import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.getopenmodels.com/v1",
apiKey: process.env.OM_API_KEY,
});
const response = await client.chat.completions.create({
model: "qwen3.5-flash",
route: { provider: "<provider-for-this-model>" },
route_mode: "balanced",
messages: [
{
role: "user",
content: "Hello! Give me a one-sentence explanation of OpenModels.",
},
],
max_tokens: 256,
});
console.log(response.choices[0].message.content);

5. If the first request fails

Use the error status and code to choose the next page:

ResponseCheck
401 or invalid_api_keyAuthentication
402 or key_market_insufficient_balanceCredits & Billing
403 or key_market_spend_limit_exceededRate Limits
400 or model unavailableModels
429, 502, 503, 504, or timeoutErrors

6. Track usage and spend

After requests start running, use Usage and Credits to monitor request volume, token usage, spend, balance, top-ups, and monthly limits.

What changes from OpenAI

What changesValue
Base URLhttps://api.getopenmodels.com/v1
API keyOM_API_KEY or your ale-... key
ModelAny supported model ID from the Models page, or a Model Route ID such as route:coding-agent
RouteOptional route.provider and route_mode controls; remove them for the default route
SDKStandard OpenAI-compatible SDKs

OpenModels API access is powered by Alephant gateway infrastructure.