OpenRouter and other routers
OpenRouter is one key and one endpoint in front of many providers. It is the way to run a Claude or Gemini model as the Dungeon Master, since the app has no native Anthropic or Google backend, and the cheapest way to try several models on one campaign.
Settings
- Create a key at openrouter.ai and add credit.
- Pick a model on openrouter.ai/models whose card lists tools among its supported parameters. Copy its id, exactly as it appears in the provider's model list.
- Enter it as an OpenAI-compatible backend:
| Field | Value |
|---|---|
| Provider | Custom backend |
| Backend URL | https://openrouter.ai/api/v1 |
| Model | The model id from the model page |
| API key | Your OpenRouter key |
On a self-hosted server that is Admin, Server settings, Text model, or OPENAI_COMPAT_* in .env.server; a campaign's Settings tab can hold its own. On a world hosted from the desktop or Android app, the same fields are in the world's admin panel (account menu, Admin), since the Story AI screen's key door is OpenAI-specific. The server also reads OPENROUTER_API_KEY and OPENROUTER_MODEL for its dedicated route; select the model explicitly. The OpenRouter key is sent only to OpenRouter's own host, over https.
What the server sends to a router
OpenRouter is recognised by host. The server sends the sampling parameters it accepts, requests thinking on tool-decision calls through the chat template hint, and caps output with max_tokens. Context sizes come from the model catalog, capped at 128K for packing. An unknown model falls back to 16K; set OPENAI_COMPAT_CONTEXT if the discovered size does not match your deployment.
Choosing a model
- Tool calling is the hard requirement. A model that lists tools but calls them rarely under a long prompt still narrates past its dice; run Test backend and try a turn or two.
- Speed matters more than at a chat box: a turn makes two or three calls. Flash and mini class models keep turns under a minute.
- Length: set the context override to the model's window so the story is not compacted early.
- Use a cheap model as the utility model and a strong one for the story.
Cost and privacy
You pay OpenRouter's per-token price for the model chosen; the dashboard shows usage per key. The prompt (story, sheets, scene, arc) goes to OpenRouter and on to the model's provider. Pictures are not routed: pair the router with ComfyUI, an OpenAI image key, or no pictures.