---
title: Use with your tools
description: 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](/app/keys) first.

## Set up in one click

The [API keys](/app/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](https://github.com/farion1231/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.

:::cards
- :terminal: [Claude Code](/docs/integrations/claude-code) Anthropic Messages API. Two environment variables or `settings.json`, with prompt caching.
- :terminal: [Codex CLI](/docs/integrations/codex-cli) OpenAI Responses API with GPT models. One model provider in `config.toml`.
- :terminal: [Gemini CLI](/docs/integrations/gemini-cli) Gemini API. Two environment variables.
- :plug: [Cherry Studio](/docs/integrations/cherry-studio) Desktop chat app. OpenAI-compatible provider, one-click import.
- :plug: [DeepChat](/docs/integrations/deepchat) Desktop chat app. OpenAI-compatible provider, one-click import.
- :plug: [AionUI](/docs/integrations/aionui) Desktop app for models and agents. OpenAI-compatible provider, one-click import.
- :layers: [OpenAI-compatible apps](/docs/integrations/openai-compatible) Any app, agent framework or library with a custom OpenAI endpoint.
- :code: [SDKs](/docs/integrations/sdks) Official OpenAI, Anthropic and Google Gen AI SDKs in Python and Node.js.
:::

## Base URL by API format {#base-urls}

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](/docs/tools) and the [browser agent](/docs/browser-agent), billed from the same balance. It authenticates with the same key. The [Claude Code](/docs/integrations/claude-code#add-data-tools-over-mcp), [Codex CLI](/docs/integrations/codex-cli#add-data-tools-over-mcp) and [Gemini CLI](/docs/integrations/gemini-cli#add-data-tools-over-mcp) guides have the one-line command. For other clients and the full list of MCP tools, see [MCP server](/docs/tools/mcp).

## 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](/models). |
| `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](/docs/account/billing). |

Each client guide lists the errors specific to that client. Every other status is covered in [Errors](/docs/api/errors).
