# Use BigModel.io with CC Switch

> Import a BigModel.io key into CC Switch with one click from the console, or add it by hand for Claude Code and Codex, and show your USD balance through /v1/usage.

Web version: https://bigmodel.io/docs/cc-switch · Updated 2026-10-18

CC Switch is a desktop app that switches Claude Code, Codex and other CLI tools between API providers. You can import a BigModel.io key with the **Import to CCS** button in the console, or add the provider by hand. CC Switch v4.0.10 or later is needed for the one-click import.

| | Claude Code in CC Switch | Codex in CC Switch |
|---|---|---|
| Endpoint | `https://bigmodel.io` (no `/v1`) | `https://bigmodel.io/v1` |
| API key | your BigModel.io key (`sk-...`) | your BigModel.io key (`sk-...`) |
| Model | a model ID from the [model catalog](https://bigmodel.io/models) | a model ID your group serves on `/v1/responses` |
| Key group must serve | `/v1/messages` | `/v1/responses` |

## One-click import from the console

1. Install and open CC Switch.
2. In [API Keys](https://bigmodel.io/keys), find the key's row and click the upload icon (**Import to CCS**). If you do not see it, the button is turned off on this site; use manual setup below.
3. Your browser asks to open CC Switch. Allow it, then confirm the import in CC Switch.

Click once. Each click creates another provider entry in CC Switch.

### What the button generates

The button opens a `ccswitch://v1/import` link with these values:

| Parameter | Value |
|---|---|
| `resource` | `provider` |
| `app` | chosen from the key's group platform, see below |
| `name` | `BigModel.io` |
| `homepage`, `endpoint` | `https://bigmodel.io` |
| `apiKey` | the full key from that row |
| `model` | `gpt-5.4`, only when `app` is `codex` |
| `usageEnabled`, `usageScript`, `usageAutoInterval` | `true`, a script that calls `/v1/usage`, `30` |

Which app the provider is created for depends on the key's group platform:

| Group platform | CC Switch app |
|---|---|
| OpenAI | Codex (model preset `gpt-5.4`) |
| Gemini | Gemini CLI |
| Anthropic, GLM, DeepSeek and others | Claude Code |

After an import into **Codex**, change the model from `gpt-5.4` to a model your key's group actually serves, unless it serves `gpt-5.4`.

> **GLM and DeepSeek groups.** A key from a Chat Completions-only group (GLM or DeepSeek platform) is imported as a **Claude Code** provider, but those groups return 404 on `/v1/messages`, so Claude Code will not work with it. For Claude Code, import a key from a group that serves Messages. For a chat-only key, use an OpenAI-protocol tool such as [OpenCode](https://bigmodel.io/docs/opencode) or [Cline](https://bigmodel.io/docs/cline) instead.

### Balance display

The imported provider includes a usage script. CC Switch calls `https://bigmodel.io/v1/usage` with your key and shows the remaining amount in USD:

- for a key with a quota or spend windows, the remaining quota;
- for a key on a plan, the lowest remaining plan limit;
- otherwise, your account balance.

`/v1/usage` keeps working when the key is expired or out of quota, so the display still updates.

## Manual setup

### Claude Code

1. In CC Switch, select **Claude Code** in the sidebar.
2. Click **+ Add Provider** and choose **Custom**.
3. Enter API key `sk-...` and endpoint `https://bigmodel.io` (no `/v1`).
4. Set the models, for example `glm-5.3` for the main model and `glm-5.3-flash` for the fast/haiku model.
5. Save and switch to the provider.

### Codex

1. Select **Codex** in the sidebar, click **+ Add Provider** and choose **Custom**.
2. Enter API key `sk-...` and endpoint `https://bigmodel.io/v1`.
3. Set the model to an ID your group serves on `/v1/responses`.
4. Save and switch. CC Switch writes a `[model_providers.custom]` block with `wire_api = "responses"` into `~/.codex/config.toml`.

### Add the balance script by hand

Open the provider's **Configure usage query**, enable it, paste this script and click **Test script**:

```js
({
  request: {
    url: "{{baseUrl}}/v1/usage",
    method: "GET",
    headers: { "Authorization": "Bearer {{apiKey}}" }
  },
  extractor: function(response) {
    const remaining = response?.remaining ?? response?.quota?.remaining ?? response?.balance;
    const unit = response?.unit ?? response?.quota?.unit ?? "USD";
    return {
      isValid: response?.is_active ?? response?.isValid ?? true,
      remaining,
      unit
    };
  }
})
```

If the test shows a request to `/v1/v1/usage` (a Codex provider whose endpoint ends in `/v1`), change the URL to `{{baseUrl}}/usage`.

## Verify the setup

Check the balance from the terminal with the same key:

```bash
curl https://bigmodel.io/v1/usage -H "Authorization: Bearer $BIGMODEL_API_KEY"
```

The `remaining` value should match what CC Switch shows. Then switch to the provider, start `claude` or `codex`, send one prompt, and confirm it appears in [Usage](https://bigmodel.io/usage).

## Troubleshooting

**"CC-Switch is not installed or the protocol handler is not registered".** CC Switch is not installed, is older than v4.0.10, or the `ccswitch://` link was blocked. Install or update it, open it once, and click the button again. Or copy the key and use manual setup.

**Nothing happens after the click.** The browser blocked the external link. Allow it to open CC Switch, or use manual setup.

**Claude Code returns 404 `not_found_error`: `... platform only supports /v1/chat/completions; /v1/messages is not available`.** The key is from a GLM or DeepSeek group. See the caveat above.

**Codex returns 503 `api_error`: `No available accounts: no available accounts supporting model: gpt-5.4`.** The imported model preset is not served by your group. Change the model in the Codex provider.

**404 on every request.** The endpoint is wrong for the app: Claude Code needs `https://bigmodel.io`, Codex needs `https://bigmodel.io/v1`.

**The balance shows an error or nothing.** Run **Test script** in **Configure usage query**, and check `~/.cc-switch/logs/cc-switch.log`. A 401 `INVALID_API_KEY` means the key in the provider is wrong or deleted.

**Two identical providers appear.** The import link was opened twice. Delete one in CC Switch.

## Related

- [Claude Code](https://bigmodel.io/docs/claude-code) for all Claude Code variables and gotchas.
- [Codex CLI](https://bigmodel.io/docs/codex-cli) for the Responses requirement.
- [Usage API](https://bigmodel.io/docs/api-usage) for the `/v1/usage` response fields.
- [Per-key limits & budgets](https://bigmodel.io/docs/key-limits) for quotas and spend windows.
