Configure AI APIs with CC Switch
Scope
This guide uses the CC Switch graphical interface to manage the lab API configuration for Claude Code and Codex on Windows, macOS, and Linux.
Enter only your personal key
Every member must use their own API key. Never paste a key into the Wiki, source code, chat, screenshots, or Git commits.
Purpose
Configure the lab AI API and Codex relay as separate CC Switch providers, then switch between providers without manually editing CLI configuration files.
Prerequisites
- You have received a personal API key and model permissions through AI API Access and Usage.
- You have installed the required Claude Code or Codex CLI.
- You have confirmed the available
<MODEL_ID>with the administrator; do not guess a model name from another person's configuration. - Your system meets the CC Switch requirements: Windows 10+, macOS 12+, or a supported mainstream Linux distribution.
Install CC Switch
Download CC Switch only from the official website or GitHub Releases.
| System | Recommended method |
|---|---|
| Windows | Download the .msi; use Windows-Portable.zip if you need a portable build |
| macOS | Run brew install --cask cc-switch, or download the .dmg |
| Debian / Ubuntu | Download the .deb matching your CPU architecture |
| Fedora / RHEL / openSUSE | Download the .rpm matching your CPU architecture |
| Other Linux | Download the .AppImage matching your CPU architecture, make it executable, and run it |
After installation, start CC Switch and confirm that its window and system-tray icon appear. See the official installation guide for full details.
Configure Claude Code
- Select Claude Code in the application switcher at the top.
- Click + in the upper-right corner, then select App-specific provider and Custom.
-
Enter these fields:
Field Value Name Lab AI APIAPI Key / Authentication <AI_API_KEY>Base URL https://kjapi.botsmart.net/v1Model The administrator-confirmed <MODEL_ID> -
If the form displays an authentication-field selector, keep the custom provider default. Switch between
ANTHROPIC_API_KEYandANTHROPIC_AUTH_TOKENonly when the administrator explicitly instructs you to do so. - Save the provider, then click Enable on the
Lab AI APIcard.
CC Switch writes the selected provider into the Claude Code configuration. Do not also keep the same variables in a shell startup file, because stale environment variables may override the graphical configuration.
Configure The Codex Relay
- Select Codex in the application switcher at the top.
- Click + in the upper-right corner, then select App-specific provider and Custom.
-
Enter these fields:
Field Value Name Lab Codex RelayAPI Key <AI_API_KEY>Base URL https://cpa114515.somnia.ltd/v1Wire API / Protocol ResponsesModel The administrator-confirmed <MODEL_ID>Requires OpenAI Auth On -
Do not enable Goal mode, local routing, or protocol conversion; the lab relay uses a native Responses configuration.
- Save the provider, then click Enable on the
Lab Codex Relaycard. - Close every running Codex process and reopen the terminal so the new configuration takes effect.
Why the Base URL includes /v1
A custom Codex provider needs the API root path. The login-page address is for account management; the CLI configuration must use https://cpa114515.somnia.ltd/v1.
Verification
- Create an empty directory that contains no research data.
- Start
claudeorcodexand send a minimal test such as “Reply only with OK.” - Confirm that the request succeeds, and ask the administrator to check the personal usage record when necessary.
- After the test, inspect the terminal, screenshots, and Git status to confirm that no API key was displayed or written.
Troubleshooting
| Symptom | Action |
|---|---|
401 or 403 |
Re-enter your personal key and ask the administrator to verify account permissions; do not send a key screenshot |
404 or protocol error |
For Codex, check that the Base URL includes /v1 and the protocol is Responses; for Claude Code, confirm that you did not use the Codex relay |
| Model unavailable | Use the administrator-confirmed model ID; do not copy another person's model name |
| The CLI still uses the old service | Exit the CLI completely; for Codex, also reopen the terminal |
| CC Switch reports an environment-variable conflict | Remove or temporarily unset stale API Base URL variables from the shell or PowerShell user environment, then restart the terminal |
| Unexpected usage | Disable the provider immediately and ask the administrator to revoke and rotate the key |
Maintenance
- Owner:
@赖咏曦(Yongxi Lai) - CC Switch: official website · source and releases · provider setup manual
- AI API:
https://kjapi.botsmart.net - Codex relay:
https://cpa114515.somnia.ltd - Last verified: 2026-08-18