cc-ping: Ping All Your Claude Code Configs in One Command
Table of Contents
- Why You Need It
- Installation
- Basic Usage
- Add a Config (ccp add)
- List All Configs (ccp list)
- Switch Config (ccp use)
- Check Current Config (ccp now)
- Remove a Config (ccp remove)
- Ping: The Core Feature
- When to Use Ping
- Where Data Is Stored
- Tips
- Tip 1: Ping Then Switch
- Tip 2: Use Descriptive Config Names
- Tip 3: Shorten Ping Timeout
- Final Thoughts
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.
Related Articles
Claude Code Agent Loop: Dissecting the Heart of an AI Coding Assistant
How does Claude Code understand your requests, invoke tools, and self-recover step by step? A source-code deep dive into the Agent Loop's core architecture — streaming responses, parallel tool execution, auto-compaction, and error recovery.
Claude Code settings.json Explained (1): Where Config Files Live and Who Wins
A complete guide to Claude Code's configuration file system — five config sources, their file paths, priority rules, array merging vs value overriding, and enterprise managed settings delivery.
Claude Code settings.json Deep Dive (Part 2): The Permissions System
A thorough breakdown of Claude Code's permissions configuration — allow/deny/ask rule arrays, wildcard syntax, MCP tool permissions, defaultMode options, and additionalDirectories.
Claude Code settings.json Deep Dive (Part 3): The Hooks System
A thorough breakdown of Claude Code's hooks configuration — four hook types, core events (PreToolUse/PostToolUse/Stop/Notification), stdin/stdout protocol, exit code semantics, and practical examples.
Claude Code settings.json Deep Dive (4): env, Models, Auth, and Other Useful Fields
A comprehensive guide to the remaining settings.json fields in Claude Code — env variable injection, model configuration, authentication helpers, Git attribution, session cleanup, language and UI, thinking depth, auto-updates, memory system, and more.