How to Connect Claude Code and Cherry Studio to a Third-Party API Relay (Up and Running in 5 Minutes)
Claude Code is Anthropic's official terminal coding agent, and Cherry Studio is one of the most popular desktop AI clients in China. By default, both connect to the official endpoints and bill at full official rates. This guide shows you how to switch their requests over to an API relay — it only takes two config changes.
Table of Contents
1. Get Your API Key First 2. Configuring Claude Code 3. Configuring Cherry Studio 4. Verification and FAQ1. Get Your API Key First
- Open RouteAPI and sign up or log in (Google one-click login supported);
- Go to "API Keys" in the left sidebar → create a key, and copy the key — it looks like
sk-xxxx; - When your balance runs low, top up online on the recharge page — funds are credited automatically after successful payment.
2. Configuring Claude Code
Claude Code points at the upstream endpoint through environment variables. Just add them to your shell config file (~/.zshrc or ~/.bashrc):
# Use a relay (Anthropic-compatible protocol)
export ANTHROPIC_BASE_URL=https://route-api.site
export ANTHROPIC_AUTH_TOKEN=sk-your-key
# Or use the OpenAI-compatible protocol (for tools that support a custom base_url)
export OPENAI_BASE_URL=https://route-api.site/v1
export OPENAI_API_KEY=sk-your-key
After saving, run source ~/.zshrc (or restart your terminal), then use the claude command as usual. See the model catalog for model names.
3. Configuring Cherry Studio
- Open Cherry Studio → "Settings" in the bottom-left corner → "Model Services";
- Choose "Add" to create an OpenAI-compatible provider (or edit an existing provider directly);
- Set the API address to
https://route-api.site/v1and paste yoursk-key into the API Key field; - Click "Fetch model list", or manually add the model names you want in the model settings (e.g.
claude-sonnet-4-6,gpt-5.6-terra); - Go back to the chat view and switch models from the top bar to get started.
4. Verification and FAQ
How do I verify it's working? Send a message — if you get a normal reply, you're all set. The "Usage" section in the console will show this call's token usage and cost.
Getting a 401 error? Check that the key was copied in full and that the address ends with /v1.
Insufficient balance? Top up on the recharge page and retry once the funds arrive.
Which models are supported? All of them — Claude, GPT, Grok, and more — are listed in the model catalog, uniformly billed at 49% of the official reference price.