# Import with CC Switch

[CC Switch](https://github.com/farion1231/cc-switch) is an open-source tool (MIT license) that switches the Claude Code and Codex configuration between multiple providers. The 2api console has a built-in import button, which suits people who already use CC Switch. If you haven't installed it, we recommend [magpie](https://docs.2api.dev/en/magpie/) instead.

1. Download and install CC Switch from [GitHub Releases](https://github.com/farion1231/cc-switch/releases). Open it once to check that it starts normally.

2. Sign in to [2api.dev](https://2api.dev) and open the API Keys (API 密钥) page.

3. Find the key you want to use and click Import to CCS (导入到 CCS) next to it. Your browser opens CC Switch and fills in the provider name, API address and key automatically. A key in a GPT group is imported into Codex. A key in the `CC-Max` group is imported into Claude Code.

4. In CC Switch, select the 2api configuration you just imported. Then **reopen** your terminal or editor and start a new session.

## Common issues

- **Nothing happens when you click import**: CC Switch isn't installed on this computer, or the browser hasn't been allowed to open `ccswitch://` links. First check that CC Switch starts normally, then click again. When the browser shows a prompt, choose Allow.
- **The old config is still used after switching**: If an old address or key is still set in your system environment variables or in `~/.zshrc`, it overrides what CC Switch writes. Delete it and reopen the terminal. Codex only reads its config at startup, so after switching, quit it fully and open it again.
- **Plugin, hooks or MCP settings disappeared**: Old versions of CC Switch overwrite the whole config file. Upgrade to the latest version. You can recover overwritten files from `~/.cc-switch/backups/`.
- **You use routing mode**: The address in the config becomes `http://127.0.0.1:...`. CC Switch must then stay open at all times.