> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apimart.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Using APIMart in CC-Switch

> A detailed guide on configuring and using APIMart API services in CC-Switch, enabling you to access multiple AI models for assisted programming with simple configuration.

## Introduction

CC-Switch is an open-source desktop application that unifies the management of API provider configurations across multiple AI coding CLI tools such as Claude Code, Codex, and Gemini CLI.
It turns tedious configuration file editing into just a few clicks in a GUI — once a provider is added, you can switch between API services instantly, with no need to edit configuration files by hand.

By connecting APIMart through CC-Switch, you can easily configure the APIMart service for Claude Code and Codex, and switch freely between multiple providers.

## Prerequisites

Before you begin, make sure you have:

1. **Installed a supported CLI tool**
   At least one supported CLI tool installed, such as [Claude Code](/en/integrations/dev-tool/claude-code) or [Codex CLI](/en/integrations/dev-tool/codex-cli)

2. **Obtained an APIMart API Key**
   Log in to the [APIMart Console](https://apimart.ai/keys) to get your API key (starts with `sk-`)

<Note>**Tip:** If you don't have an APIMart account yet, please register at [APIMart](https://apimart.ai) first and obtain your API key.</Note>

## Step 1: Install CC-Switch

Choose the installation method based on your operating system:

<Tabs>
  <Tab title="macOS">
    Install via Homebrew (recommended):

    ```bash theme={null}
    brew tap farion1231/ccswitch
    brew install --cask cc-switch
    ```

    You can also download the `.dmg` installer from [GitHub Releases](https://github.com/farion1231/cc-switch/releases). CC-Switch is signed and notarized by Apple, so it can be installed directly (requires macOS 12 or later).
  </Tab>

  <Tab title="Windows">
    Download the `.msi` installer or the portable `.zip` from [GitHub Releases](https://github.com/farion1231/cc-switch/releases).

    Requires Windows 10 or later.
  </Tab>

  <Tab title="Linux">
    Download the appropriate package from [GitHub Releases](https://github.com/farion1231/cc-switch/releases):

    * Debian / Ubuntu: `.deb` package
    * Fedora / RHEL: `.rpm` package
    * Universal: `.AppImage` format
    * Arch Linux: `paru -S cc-switch-bin`
  </Tab>
</Tabs>

<Note>When CC-Switch is launched for the first time, it automatically detects CLI tools installed on your machine and can import existing configurations as the default providers.</Note>

## Step 2: Add the APIMart Provider

At the top of the CC-Switch main window you can switch between different CLI tool groups. Refer to the steps below based on the tool you want to configure.

<Tabs>
  <Tab title="Configure for Claude Code">
    **1. Switch to the Claude Code group**

    Select **Claude Code** at the top of the main window.

    **2. Open the Add Provider panel**

    Click the **+** button at the top-right corner of the main window.

    **3. Fill in the provider details**

    Fill out the form as follows:

    | Field            | Value                    | Description                              |
    | ---------------- | ------------------------ | ---------------------------------------- |
    | **Name**         | `APIMart`                | Custom label for easy identification     |
    | **Endpoint URL** | `https://api.apimart.ai` | APIMart API base URL                     |
    | **API Key**      | `sk-xxxxxxxxxxxx`        | Your APIMart API key                     |
    | **API Format**   | `Anthropic Messages`     | Keep the default Anthropic-native format |

    <Frame>
      <img src="https://mintcdn.com/apicore/_1ZGW4_iuaSfzpC6/images/integrations/cc-switch/step-2.png?fit=max&auto=format&n=_1ZGW4_iuaSfzpC6&q=85&s=7d91af6ec3f40c7bb2666ba455a09faa" alt="CC-Switch main interface" width="2024" height="1480" data-path="images/integrations/cc-switch/step-2.png" />
    </Frame>

    **4. Save the configuration**

    Click **Add** to save. APIMart will appear in the provider list.
  </Tab>

  <Tab title="Configure for Codex">
    **1. Switch to the Codex group**

    Select **Codex** at the top of the main window.

    **2. Open the Add Provider panel**

    Click the **+** button at the top-right corner of the main window.

    **3. Fill in the provider details**

    A Codex provider is configured through two blocks:

    Fill in the API key in the **auth.json** block:

    ```json theme={null}
    {
      "OPENAI_API_KEY": "sk-xxxxxxxxxxxx"
    }
    ```

    Fill in the provider config in the **config.toml** block:

    ```toml theme={null}
    model = "gpt-5.5"
    model_provider = "apimart"

    [model_providers.apimart]
    name = "APIMart"
    base_url = "https://api.apimart.ai/v1"
    wire_api = "responses"
    requires_openai_auth = true
    ```

    **4. Save the configuration**

    Name the provider (e.g., `APIMart`) and click **Add** to save. CC-Switch will automatically validate both the JSON and the TOML.
  </Tab>
</Tabs>

<Note>
  **About the endpoint URL:** Claude Code uses the Anthropic-native format with the URL `https://api.apimart.ai` (no `/v1`); Codex uses the OpenAI-compatible format with the URL `https://api.apimart.ai/v1` (with
  `/v1`). Do not mix them up.
</Note>

## Step 3: Switch Providers

Once added, you can switch between APIMart and other providers at any time:

### Switch in the main window

1. Select **APIMart** in the provider list
2. Click the **Enable** (or **Use**) button
3. A "Switched successfully" toast confirms the change

<Frame>
  <img src="https://mintcdn.com/apicore/LdtR-ceBhXT3_e8B/images/integrations/cc-switch/step-1.png?fit=max&auto=format&n=LdtR-ceBhXT3_e8B&q=85&s=46a838ac93d721254556c464cc0b4864" alt="CC-Switch main interface" width="2224" height="1676" data-path="images/integrations/cc-switch/step-1.png" />
</Frame>

### Switch from the system tray

CC-Switch stays in the system tray, so you can switch without opening the main window:

1. Click the CC-Switch icon in the system tray
2. Click the target provider name in the menu — it takes effect immediately

<Note>**About activation:** Claude Code supports hot switching — new sessions pick up the new configuration automatically. After switching for Codex, you need to restart the terminal or Codex for the change to take effect.</Note>

## Supported Models

After switching to the APIMart provider, you can use a variety of models in the corresponding CLI tool:

| Model ID            | Strengths               | Recommended Use Cases                |
| ------------------- | ----------------------- | ------------------------------------ |
| `claude-opus-4-6`   | Strongest overall       | Complex architecture, hard debugging |
| `claude-sonnet-4-6` | Balanced perf & speed   | Day-to-day coding, code generation   |
| `gpt-5.5`           | Excellent coding skills | Complex engineering tasks            |
| `gpt-4o`            | High performance, fast  | Everyday coding, fast iteration      |

<Tip>
  In Claude Code, use the `/model` command to switch models; in Codex, use the `/model` command as well. For the full model list, see the [Claude Code guide](/en/integrations/dev-tool/claude-code) and the [Codex CLI
  guide](/en/integrations/dev-tool/codex-cli).
</Tip>

## FAQ

### Q1: Switching providers doesn't take effect?

* **Claude Code**: Supports hot switching — start a new session; if it still doesn't work, restart Claude Code
* **Codex**: After switching, restart the terminal or Codex

### Q2: API key reported as invalid?

1. Make sure the API key starts with `sk-` and is copied in full with no extra whitespace
2. Go to the [APIMart Console](https://apimart.ai/keys) to confirm the key is active
3. Check that the endpoint URL is correct (Claude Code uses `https://api.apimart.ai`, Codex uses `https://api.apimart.ai/v1`)

### Q3: Format error when adding a Codex provider?

CC-Switch validates `auth.json` (JSON syntax) and `config.toml` (TOML syntax). Check that:

* Brackets, quotes, and commas in the JSON are complete
* No full-width / smart quotes are used
* Field names in the TOML are spelled correctly

### Q4: Which files does CC-Switch modify?

CC-Switch writes to the configuration files of each tool:

* **Claude Code**: `~/.claude/settings.json`
* **Codex**: `~/.codex/config.toml` and `~/.codex/auth.json`

CC-Switch automatically backs up these files before switching, so you don't need to edit them by hand.

### Q5: How do I view API usage and billing?

Log in to the [APIMart Console](https://apimart.ai/overview) to view API call statistics, token consumption details, and cost trends.

## Support and Help

If you run into any issues while using CC-Switch:

* 📚 [APIMart Documentation Center](https://docs.apimart.ai)
* 📚 [CC-Switch Project Page](https://github.com/farion1231/cc-switch)
* 💬 [Discord Community](https://discord.gg/V8zqssyZ5c)
* 🐦 [Twitter @APIMart\_](https://x.com/APIMart_)
* 📧 Technical support: [zhihong@apimart.ai](mailto:zhihong@apimart.ai)

***

<Card title="Get Started with APIMart" icon="rocket" href="https://apimart.ai">
  Sign up for APIMart now, grab your API key, and manage multiple AI coding tools effortlessly in CC-Switch!
</Card>
