Use with your tools
Point Claude Code, Codex CLI, Gemini CLI, desktop chat apps and the official SDKs at Lovely Router with one API key.
Any tool that lets you change its API base URL works with Lovely Router. You change two settings, the base URL and the key, and keep everything else. You need an API key first.
Set up in one click#
The API keys page has a Use in tools button on every key, and a Use in tools… button next to a key you just created. It opens a dialog with the setup for each client below, filled in with your key, plus one-click import links:
- Claude Code, Codex CLI, Gemini CLI: Import with CC Switch adds Lovely Router as a provider in the CC Switch desktop app, with the models already set. CC Switch must be installed.
- Cherry Studio, DeepChat, AionUI: Open in the app adds Lovely Router as a provider. The app must be installed.
Right after you create a key, the dialog already contains it. For an existing key, paste the full key into the dialog: Lovely Router stores only a hash, so it can't show the key again.
Configure your client#
Each guide has the full setup for one client: the commands and config files, which models to pick, and fixes for common errors.
Anthropic Messages API. Two environment variables or settings.json, with prompt caching.
OpenAI Responses API with GPT models. One model provider in config.toml.
Gemini API. Two environment variables.
Desktop chat app. OpenAI-compatible provider, one-click import.
Desktop chat app. OpenAI-compatible provider, one-click import.
Desktop app for models and agents. OpenAI-compatible provider, one-click import.
Any app, agent framework or library with a custom OpenAI endpoint.
Official OpenAI, Anthropic and Google Gen AI SDKs in Python and Node.js.
Base URL by API format#
The base URL depends on the API the client speaks, not on the model:
| API format | Clients | Base URL |
|---|---|---|
| Anthropic Messages | Claude Code, Anthropic SDK | https://lovelyrouter.com |
| OpenAI Chat Completions and Responses | Codex CLI, OpenAI SDK, OpenAI-compatible apps | https://lovelyrouter.com/v1 |
| Gemini | Gemini CLI, Google Gen AI SDK | https://lovelyrouter.com |
| OpenAI-compatible "API host" | Cherry Studio, DeepChat, AionUI | https://lovelyrouter.com (the app adds /v1) |
Give your agent data tools over MCP#
The MCP server at https://lovelyrouter.com/mcp gives any MCP client the data tools and the browser agent, billed from the same balance. It authenticates with the same key. The Claude Code, Codex CLI and Gemini CLI guides have the one-line command. For other clients and the full list of MCP tools, see MCP server.
Troubleshooting#
| Symptom | Fix |
|---|---|
401 with Missing API key | The tool isn't sending the key. Check the variable name, and that you exported it in the shell that starts the tool. |
401 with Invalid or revoked API key | The key is mistyped, truncated or revoked. Paste it again, or create a new one. |
404 with Model '...' is not available | The model id doesn't exist. Copy an id from GET /v1/models or the model list. |
404 with Unknown endpoint | The tool is calling an API Lovely Router doesn't serve, such as embeddings or audio. Switch it to Chat Completions, the Responses API, or the Anthropic or Gemini format. |
404 on a path containing /v1/v1/ | The app appends /v1 itself. Use https://lovelyrouter.com as the host. |
402 | Your balance is empty or the key reached its spend limit. See Credits & billing. |
Each client guide lists the errors specific to that client. Every other status is covered in Errors.