cc-ping: Ping All Your Claude Code Configs in One Command
Why You Need It
When using Claude Code, you might run into situations like these:
- You have an official API key plus a few third-party relays, and you’re not sure which one is fastest
- You want to switch to a different key, but every time you have to manually edit
~/.claude/settings.json - One of your relays went down, but you didn’t know — until Claude Code hung with no response
If you only have one API key, none of this matters. But in practice, many people have multiple keys or relay endpoints. Switching between them means manually editing a JSON file, changing ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL — tedious, error-prone, and with no way to compare which endpoint is actually faster.
That’s the problem cc-ping solves.
cc-ping (CLI shorthand ccp) is a lightweight CLI tool that manages multiple Claude Code configurations, switches between them instantly, and pings all endpoints in parallel — ranked by response time so you can see which one is fastest at a glance.
Installation
npm i -g cc-ping
After installation, the ccp command is available.
Basic Usage
cc-ping has six simple commands.
Add a Config (ccp add)
$ ccp add
? Enter a name for this config: official
? Token (ANTHROPIC_AUTH_TOKEN): sk-ant-xxx
? Base URL (ANTHROPIC_BASE_URL): https://api.anthropic.com
An interactive prompt asks for three things: name, token, and base URL. Each config represents one set of Claude Code credentials.
You can add multiple configs:
$ ccp add
? Enter a name for this config: relay1
? Token (ANTHROPIC_AUTH_TOKEN): cr_xxx
? Base URL (ANTHROPIC_BASE_URL): http://relay1.example.com/api
$ ccp add
? Enter a name for this config: relay2
? Token (ANTHROPIC_AUTH_TOKEN): cr_xxx
? Base URL (ANTHROPIC_BASE_URL): http://relay2.example.com/api
List All Configs (ccp list)
$ ccp list
Configs:
* official (https://api.anthropic.com)
relay1 (http://relay1.example.com/api)
relay2 (http://relay2.example.com/api)
The * marks the currently active config.
Switch Config (ccp use)
$ ccp use relay1
Switched to "relay1"
Token: cr_xxx...
BaseURL: http://relay1.example.com/api
One command to switch. Under the hood, it does two things:
- Records the selected config name in
~/ccp.json - Writes the token and base URL to the
envfield in~/.claude/settings.json
The next time you start Claude Code, it will automatically use the new config. It only modifies env.ANTHROPIC_AUTH_TOKEN and env.ANTHROPIC_BASE_URL — your other settings (MCP, permissions, etc.) are completely untouched.
Check Current Config (ccp now)
$ ccp now
official is now in use
Quickly confirm which config is currently active.
Remove a Config (ccp remove)
$ ccp remove relay2
Config "relay2" deleted successfully.
If you remove the currently active config, the default pointer is cleared.
Ping: The Core Feature
This is cc-ping’s most valuable feature — ping all configs in parallel to test connectivity and response time.
$ ccp ping
Pinging 3 config(s) in parallel (timeout: 20s)...
✓ official (https://api.anthropic.com) 8.3s
✓ relay1 (http://relay1.example.com/api) 10.7s
✗ relay2 (http://relay2.example.com/api) timeout
Here’s what it does:
- Reads all saved configs
- Calls
claude --print -p "hi"for each config in parallel - Records the response time for each
- Sorts and displays results from fastest to slowest
The output is straightforward: ✓ means healthy, ✗ means timeout or error, with elapsed time shown right beside it.
The default timeout is 20 seconds, and you can customize it:
$ ccp ping -t 10 # 10-second timeout
When to Use Ping
- Pick the fastest endpoint: After adding multiple relays, ping to find the fastest one, then
ccp useto switch - Daily health check: Ping before starting work to make sure all endpoints are up
- Troubleshooting: When Claude Code feels unusually slow, ping to check if it’s the current endpoint — if so, switch to another one in seconds
Where Data Is Stored
cc-ping’s data storage is straightforward:
| File | Location | Purpose |
|---|---|---|
ccp.json | ~/ccp.json | Stores all configs and the currently selected config name |
settings.json | ~/.claude/settings.json | Claude Code’s settings file; ccp use writes to its env field |
Here’s roughly what ccp.json looks like:
{
"default": "official",
"official": {
"Name": "official",
"Token": "sk-ant-xxx",
"BaseURL": "https://api.anthropic.com"
},
"relay1": {
"Name": "relay1",
"Token": "cr_xxx",
"BaseURL": "http://relay1.example.com/api"
}
}
The default field tracks the active config name; everything else is config details.
Tips
Tip 1: Ping Then Switch
$ ccp ping
Pinging 3 config(s) in parallel (timeout: 20s)...
✓ relay1 (http://relay1.example.com/api) 5.2s
✓ official (https://api.anthropic.com) 8.3s
✗ relay2 (http://relay2.example.com/api) timeout
$ ccp use relay1
Switched to "relay1"
See which is fastest, then switch — two steps and you’re done.
Tip 2: Use Descriptive Config Names
Name configs by provider or characteristic:
official # Official API
relay-hk # Hong Kong relay
relay-us # US relay
backup # Backup key
This makes ccp list and ccp ping output instantly readable.
Tip 3: Shorten Ping Timeout
The default 20-second timeout can feel long for quick health checks. If you just want to see which endpoints are alive, shorten it:
$ ccp ping -t 5
If an endpoint hasn’t responded in 5 seconds, the experience probably won’t be great anyway.
Final Thoughts
cc-ping solves a simple problem: making multi-key, multi-relay management painless.
Without it, you’re manually editing JSON files to switch configs, guessing which endpoint is slow. With it, ccp ping tells you which is fastest, ccp use switches you over — the whole workflow drops from minutes to seconds.
If you have more than one Claude Code API key or relay endpoint, give npm i -g cc-ping a try — make switching and speed-testing as simple as a ping.
More Articles
- I Built a Bot That Runs Claude Code From Chat
- Claude Code /fast: Same Opus, 2x Speed — Worth It?
- Claude Code /init: Generate CLAUDE.md in 10 Seconds
- Claude Code MCP: Give Your AI Access to Any Tool
- Claude Code /model: Opus vs Sonnet vs Haiku Guide
- Claude Code in 2026: The Only Setup Guide You Need
- The Complete Guide to Claude: From Chat to Code to Automation
- CCBot - 24x Development Efficiency Boost
- Shocking! This Tool Lets Programmers Finish 95 Minutes of Work in 4 Minutes! 24x Efficiency Boost
- Claude Code /add-dir: The Monorepo Command You Miss
- Claude Code /compact: Free Up Context, Keep Progress
- Claude Code /btw Command Explained: Quick Side Questions Without Breaking Flow
- Claude Code /stats: See How Much AI Does For You
- Claude Code /status Command Explained: Your Session Dashboard
- Why AI-First Startups Only Need One Programming Language
- Best Practice for External Knowledge in Claude Code: GitHub MCP + Context7
- Claude Code Token-Saving Tip: The Power of the Exclamation Mark
- Claude Code /resume Command Explained: Don't Let Your Conversations Go to Waste
- Claude Code /usage Command Explained: Know Your Remaining Quota
- Claude Code /tasks Command Explained: Master Your Background Tasks
- Claude Code Skills Explained: Build Your Custom Command Library
- Claude Code /plan Explained: Think Before You Code
- Claude Code /memory Explained: Make AI Truly Remember Your Project