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

# Use A2Agent Models with Codex Desktop (CC Switch Setup Guide)

> Codex Desktop lacks a custom-endpoint field, so add A2Agent as a provider with CC Switch and enable routing to run coding tasks on A2Agent models.

Codex Desktop doesn't expose a custom endpoint field, so this guide uses CC Switch to add A2Agent as a provider and turn on routing. After that, your coding sessions run on A2Agent models instead of OpenAI's.

The setup mirrors the Claude Desktop flow: add a provider in CC Switch, enter your A2Agent key and base URL, then select a model in Codex Desktop.

## Prerequisites

* Codex Desktop installed

* CC Switch installed —[Switch download](https://ccswitch.io/zh/download)

* An A2Agent API key — [sign up at a2agent.me/register](https://a2agent.me/register) to get one

## Setup

<Steps>
  <Step title="Add a Provider">
    Open CC Switch, switch to the **Codex** tab at the top, and click the orange **「+」** in the top-right corner.On the **Add New Provider** page, keep **Codex** as the provider and click **Custom Configuration** in the top-left corner.

    <img src="https://mintcdn.com/a2agent/ZWlT58MoBv3YnzWR/images/image-3.png?fit=max&auto=format&n=ZWlT58MoBv3YnzWR&q=85&s=c65f0c09f6d9073205614d550ac23d41" alt="Image" width="954" height="95" data-path="images/image-3.png" />
  </Step>

  <Step title="Fill in the Provider Information">
    * Provider Name：Custom, e.g. `A2Agent-Codex.`

    * API Key：Your A2Agent API key.

    * API Base URL:[https://api.a2agent.me/v1](https://api.a2agent.me/v1) (OpenAI Responses-compatible endpoint; must end with `/v1`).
          <img src="https://mintcdn.com/a2agent/ZWlT58MoBv3YnzWR/images/image-5.png?fit=max&auto=format&n=ZWlT58MoBv3YnzWR&q=85&s=2b6d140fc45c351ebb1f4e3a3afb0abc" alt="Image" width="1077" height="485" data-path="images/image-5.png" />

    * Default Model:Click the download button on the right to fetch a2agent Models, then choose the model you want, e.g:`deepseek-v4-pro.`
          <img src="https://mintcdn.com/a2agent/ZWlT58MoBv3YnzWR/images/image-6.png?fit=max&auto=format&n=ZWlT58MoBv3YnzWR&q=85&s=81a8292c85219639727cde5b7b89cd19" alt="Image" width="1042" height="107" data-path="images/image-6.png" />

    * Advanced Options:To switch models when using Codex, configure model mapping in Advanced Options, select “Chat Completions” as the Upstream Format , and then click Add Model after fetching the model list.
          <img src="https://mintcdn.com/a2agent/ZWlT58MoBv3YnzWR/images/image-7.png?fit=max&auto=format&n=ZWlT58MoBv3YnzWR&q=85&s=410a3da400680e4250fe398420855555" alt="Image" width="1003" height="88" data-path="images/image-7.png" />
  </Step>

  <Step title="Configure config.toml (TOML)">
    Write the following configuration to the Codex config file:

    ```toml theme={null}
    model_provider = "a2agent"
    model = "deepseek-v4-pro"
    disable_response_storage = true
    supports_websockets = false

    [model_providers]
    [model_providers.a2agent]
    name = "a2agent"
    base_url = "https://api.a2agent.me/v1"
    wire_api = "responses"
    requires_openai_auth = true
    ```

    When finished, click **「 + Add 」** in the bottom-right corner.
  </Step>

  <Step title=" Enable Routing">
    * Click **Settings** in the top-left corner → **Routing** → **Local Routing**.
    * Turn on **Show the local routing switch on the main page**.
    * Turn on the **Routing master switch**.
          <img src="https://mintcdn.com/a2agent/ZWlT58MoBv3YnzWR/images/image-8.png?fit=max&auto=format&n=ZWlT58MoBv3YnzWR&q=85&s=f64c129f92b255ba98015e560f7029d7" alt="Image" width="1083" height="535" data-path="images/image-8.png" />
  </Step>

  <Step title="Enable the Provider Channel">
    * Return to the provider list and click Enable on the A2Agent-Codex card.
    * When the button shows In Use, the provider has been enabled.
  </Step>
</Steps>

After completing the configuration, restart CC-Switch and Codex, and you can then start using it.
