OpenRouter¶
One key and one bill for hundreds of models from many vendors (OpenAI, Anthropic, Google, Meta, Qwen, DeepSeek ...). Handy for comparing models on the same lab without opening an account at each vendor. Keep embeddings on Ollama. Official docs: models · API keys · LiteLLM guide.
Setup¶
- Sign up at openrouter.ai, buy credits, and set a credit limit on the key.
- Create a key at openrouter.ai/keys.
- From the ai-learning folder:
uv pip install -e '.[hosted]', thencp .env.example .env(if you haven't) and set:LLM_MODEL=openrouter/<vendor>/<model> # e.g. the id shown on the model's page, after openrouter/ OPENROUTER_API_KEY=sk-or-... EMBED_MODEL=ollama/nomic-embed-text - Check:
python -c "import door; print(door.describe())", thencd llm-api && python tools.py.
Picking a model¶
Model ids are <vendor>/<model> on openrouter.ai/models; put openrouter/ in front.
Filter by Tools (and Structured outputs) support: the agent, MCP and WhatsApp labs need tool calling, and most
RnR labs need JSON-schema output. A quick way to compare: run one lab's eval with two LLM_MODEL values and diff the scores.
What's different¶
- OpenRouter forwards to an upstream provider, which can change between calls; latency and small details vary.
- Each upstream provider has its own data terms; OpenRouter's settings let you exclude providers that train on prompts.
- Prices are the vendor's plus OpenRouter's fee; the model page shows both input and output prices.
Troubleshooting¶
| Symptom | Fix |
|---|---|
401 AuthenticationError |
Wrong or missing OPENROUTER_API_KEY |
| 402 payment required | Out of credits, or the key's credit limit was reached |
| Tool or schema errors on one model | That model or its upstream lacks support: pick one with the Tools filter |
Shared rules for data, keys, cost and evals: README.md.