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, for example
anthropic/claude-sonnet-4.5orgoogle/gemini-3.5-flash. - 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 Setup 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 as a dedicated route with a sensible default model. 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. The context window is the 16K stand-in unless you set OPENAI_COMPAT_CONTEXT to the model's real size, which you should: a Claude or Gemini model has far more room than that.
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.