Everything you need to get started with AnyRouter.
Install AnyRouter, add your API keys, and start routing in under a minute.
# macOS / Linux
$ curl -fsSL https://www.anyrouter.planixx.com/scripts/install.sh | bash# Windows (PowerShell as Admin)
PS> powershell -c "irm https://www.anyrouter.planixx.com/scripts/install.ps1 | iex"# Start the interactive TUI
$ anyrouter
# Or start directly in server mode
$ anyrouter --servePoint your LLM client to:
# AnyRouter endpoint (drop-in for OpenAI SDK)
$ http://127.0.0.1:9876/v1/chat/completionsThat's it. AnyRouter works as a drop-in replacement for any OpenAI SDK.
Configuration is stored in anyrouter.yaml. You can edit it directly or use the interactive TUI.
server:
host: 127.0.0.1
port: 9876
log_level: info
providers:
openai:
enabled: true
base_url: https://api.openai.com/v1
api_key: ${OPENAI_API_KEY}
format: openai
models:
- gpt-4o
- gpt-4o-mini
openai:
api_keys:
- ${OPENAI_KEY_1}
- ${OPENAI_KEY_2}
- ${OPENAI_KEY_3}
Set your API keys as environment variables. AnyRouter reads them at startup.
# OpenAI
export OPENAI_API_KEY=sk-...
# Anthropic
export ANTHROPIC_API_KEY=sk-ant-...
# Google Gemini
export GEMINI_API_KEY=...
# Or create a .env file (optional)
AnyRouter supports 30+ providers. The anyrouter.yaml file includes defaults for all of them — just set the corresponding environment variables.
Requests are routed to the correct provider based on the model name. Pre-configured patterns handle all major providers.
# Default routing patterns
models:
- pattern: claude- → anthropic
- pattern: gpt- → openai
- pattern: gemini- → gemini
- pattern: deepseek- → deepseek
- pattern: mistral- → mistral
- pattern: grok- → xai
Add custom routing patterns for any model or provider.
AnyRouter automatically handles failures at three levels:
If one API key hits a rate limit, the next key is tried automatically.
openai:
models:
- gpt-4o
model_fallbacks:
- gpt-4o-mini
openai:
fallbacks:
- azure
- openrouter
The failover chain is: Key 1 → Key 2 → Model fallback → Provider fallback. If all fail, the client receives a clear error.
OpenAI-compatible chat completions endpoint. Accepts standard OpenAI request format.
Anthropic-compatible messages endpoint. Accepts standard Anthropic request format.
Returns the list of available models across all configured providers.
Health check endpoint. Returns provider health status.
Debug endpoint showing current route mappings.
The TUI provides a full terminal interface for managing AnyRouter:
# Launch the TUI
anyrouter
$ git clone https://github.com/JeanChristopherPL/AnyRouter-Ai.git
$ cd AnyRouter-Ai
$ go build -o anyrouter .Requires Go 1.21 or later.