LLM Router overview
Call 100+ LLMs through one API, route requests, and measure results. Start with your first request.
LLM Router gives you one API for 100+ LLMs from OpenAI, Anthropic, Google, and more. It automatically tries a fallback when a provider fails. You can route users or requests to different models, A/B test models and prompts, and measure the results: cost, latency, retention, and revenue.
New: video generation. The same API key now generates short video clips from a text prompt or images. See Video generation.
Quickstart
Follow the steps to make your first API call.
LLM Playground
Compare models and routers side by side in the Portal.
Code examples
Find code examples on GitHub.
Using AI to code? Give your assistant the docs index at https://docs.inworld.ai/llms.txt. For live search, add the MCP server.
Prefer the terminal? Install the Inworld CLI with npm install -g @inworld/cli. Use it to send chat completions, list models, and create API keys. AI agents can use it too.
Your first request
Set INWORLD_API_KEY to the Base64 credential from the Portal, then send a chat completion. Use model: "auto" to let the router choose a model. To choose one yourself, set a provider/model ID such as openai/gpt-5.
curl --request POST \
--url https://api.inworld.ai/v1/chat/completions \
--header "Authorization: Basic $INWORLD_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "auto",
"messages": [
{"role": "user", "content": "Write a 50-word bio for a software engineer."}
]
}'import os
from openai import OpenAI
api_key = os.environ["INWORLD_API_KEY"]
client = OpenAI(
base_url="https://api.inworld.ai/v1",
api_key=api_key,
default_headers={"Authorization": f"Basic {api_key}"},
)
response = client.chat.completions.create(
model="auto",
messages=[{"role": "user", "content": "Write a 50-word bio for a software engineer."}],
)
print(response.choices[0].message.content)The request follows OpenAI's chat completions format, so you can use the OpenAI SDKs without changes. The quickstart shows how to create a router in the Portal and send requests through it.
Explore
Chat completions
Learn the request format and explore its capabilities.
Tool calling
Let models call your functions, on any provider.
Routing concepts
Routers, routes, variants, and fallbacks.
Models
The models and providers you can route to.
API reference
Every parameter on chat completions.
To generate and speak an answer in one API call, use Voice responses. To switch from another gateway, see Migrate from OpenRouter or Migrate from Anthropic.