OpenRouter is a unified API that provides access to hundreds of models from providers like Anthropic, Google, Meta, Mistral, and more through a single endpoint. It requires you to bring your own key—ngrok-managed keys are not available for OpenRouter.Documentation Index
Fetch the complete documentation index at: https://ngrok.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Setup
Create an AI Gateway endpoint
If you don’t have one yet, follow the quickstart to create your AI Gateway endpoint.
Get an OpenRouter API key
Create an account at openrouter.ai and generate an API key from your dashboard. Keys start with
sk-or-v1-.Model names
OpenRouter uses aprovider/model format for its model IDs. When calling through the ngrok AI Gateway, prefix with openrouter::
| What you want | Model string to use |
|---|---|
| Anthropic Claude via OpenRouter | openrouter:anthropic/claude-3.5-sonnet |
| Google Gemini via OpenRouter | openrouter:google/gemini-2.0-flash-001 |
| Meta Llama via OpenRouter | openrouter:meta-llama/llama-3.1-8b-instruct |
| Mistral via OpenRouter | openrouter:mistralai/mistral-7b-instruct |
openrouter: prefix tells the gateway to route to OpenRouter specifically, not to the native provider. Without it, anthropic/claude-3.5-sonnet would fail—the gateway doesn’t recognize the slash-separated format as a valid model without the provider prefix.
For the full list of models OpenRouter supports, see openrouter.ai/models.
Store key in the gateway
Instead of each client passing their own key, you can store it once in ngrok Secrets and have the gateway inject it automatically.Store your key in ngrok secrets
Failover with another provider
Use OpenRouter as a fallback if your primary provider is unavailable:models: ["anthropic:claude-3.5-sonnet", "openrouter:anthropic/claude-3.5-sonnet"] to fall back to OpenRouter if Anthropic is down.
Next steps
- Protecting BYOK Endpoints: add authorization to your endpoint
- Managing Provider Keys: key rotation and multiple keys
- Multi-provider failover: failover patterns
- Model Selection Strategies: custom routing logic