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

# ChatGPT(Codex) 接入 Global AI：CC Switch 与手动配置

> 在 ChatGPT(Codex) 客户端中接入 Global AI，通过 CC Switch 一键切换或手动编辑 config.toml 与 auth.json。

ChatGPT(Codex) 是 OpenAI 官方的命令行与桌面客户端。本页面说明如何把它接入 Global AI，替代直连官方 API。桌面端下载地址：[openai.com/zh-Hans-CN/codex](https://openai.com/zh-Hans-CN/codex/)。

<Warning>
  Codex 配置中的密钥必须使用 **Codex 分组** 的令牌，其他模型厂商的令牌无法调用。请在 [globalai.vip/keys](https://globalai.vip/keys) 创建密钥时选择 codex 分组。
</Warning>

<Note>
  以下两种方式任选其一：**CC Switch** 适合桌面端图形化操作，**手动配置** 适合熟悉命令行与配置文件的用户。
</Note>

## 方式一：CC Switch（推荐）

CC Switch 是一款一键切换供应商的桌面工具，同时支持 Claude Code 与 ChatGPT(Codex)。下载地址：[github.com/farion1231/cc-switch/releases](https://github.com/farion1231/cc-switch/releases)。

Global AI 支持将 API 配置一键导入 CC Switch，步骤如下：

<Steps>
  <Step title="创建 Codex 分组密钥">
    登录 Global AI 平台，在左侧菜单进入「API 密钥」，或直接打开 [globalai.vip/keys](https://globalai.vip/keys)，创建一个位于 **codex 分组** 的密钥。
  </Step>

  <Step title="打开 CC Switch 导入菜单">
    在刚创建的密钥最右侧点击「...」按钮，在下拉菜单中选择「CC Switch」。

    <img src="https://mintcdn.com/globalai/ERAjY6P56loyiAIX/images/image.png?fit=max&auto=format&n=ERAjY6P56loyiAIX&q=85&s=b4f29cb3bf5e4d49cb4edd046ee7b022" alt="在密钥菜单中选择 CC Switch" width="1158" height="475" data-path="images/image.png" />
  </Step>

  <Step title="填写导入信息">
    在弹出的对话框中：

    * **应用**：选择 `Codex`
    * **名称**：按需自定义
    * **主模型**：选择 `gpt-5.6-sol`

    确认无误后点击底部的「打开 CC Switch」。

    <img src="https://mintcdn.com/globalai/ERAjY6P56loyiAIX/images/image-1.png?fit=max&auto=format&n=ERAjY6P56loyiAIX&q=85&s=44aa2bbbd3fb205f7b47be1ab21eb2c0" alt="填写 CC Switch 导入信息" style={{ width:"53%" }} width="447" height="543" data-path="images/image-1.png" />
  </Step>

  <Step title="确认打开 CC Switch">
    在浏览器弹出的对话框中确认打开 CC Switch 应用。

    <img src="https://mintcdn.com/globalai/ERAjY6P56loyiAIX/images/image-2.png?fit=max&auto=format&n=ERAjY6P56loyiAIX&q=85&s=47631fdc8b030164eb35adad95a0273f" alt="确认打开 CC Switch" style={{ width:"62%" }} width="456" height="214" data-path="images/image-2.png" />
  </Step>

  <Step title="导入配置">
    在 CC Switch 中点击「导入」，等待提示导入成功。

    <img src="https://mintcdn.com/globalai/ERAjY6P56loyiAIX/images/image-3.png?fit=max&auto=format&n=ERAjY6P56loyiAIX&q=85&s=9085331425ab5a7e36643a206d2c53d2" alt="点击导入按钮" width="987" height="915" data-path="images/image-3.png" />
  </Step>

  <Step title="发送测试消息">
    打开 ChatGPT(Codex) 客户端，发送一条测试消息。

    <img src="https://mintcdn.com/globalai/ERAjY6P56loyiAIX/images/image-5.png?fit=max&auto=format&n=ERAjY6P56loyiAIX&q=85&s=ec37453acc8f7182c585268dd260b0a7" alt="在 Codex 中发送测试消息" width="1435" height="1035" data-path="images/image-5.png" />
  </Step>

  <Step title="验证接入状态">
    进入 [使用日志](https://globalai.vip/usage-logs/common)，若能看到与测试同一时间的调用记录，则代表接入成功。

    <img src="https://mintcdn.com/globalai/ERAjY6P56loyiAIX/images/image-6.png?fit=max&auto=format&n=ERAjY6P56loyiAIX&q=85&s=6223ea67fe9a11629a864ee497d96b7b" alt="查看使用日志确认接入成功" width="1148" height="418" data-path="images/image-6.png" />
  </Step>
</Steps>

## 方式二：手动配置

<Steps>
  <Step title="安装 ChatGPT(Codex) 客户端">
    从 [openai.com/zh-Hans-CN/codex](https://openai.com/zh-Hans-CN/codex/) 下载并安装桌面客户端。
  </Step>

  <Step title="编辑 config.toml">
    根据操作系统找到配置文件路径：

    * **Windows**：`C:\Users\你的用户名\.codex\config.toml`
    * **macOS / Linux**：`~/.codex/config.toml`

    写入以下内容：

    ```toml config.toml icon=file-code theme={null}
    model_provider = "globalai"
    model = "gpt-5.6-sol"
    model_reasoning_effort = "high"
    disable_response_storage = true


    [model_providers.globalai]
    name = "globalai"
    base_url = "https://globalai.vip/v1"
    wire_api = "responses"
    requires_openai_auth = true
    ```
  </Step>

  <Step title="编辑 auth.json">
    根据操作系统找到文件路径（不存在请自行创建）：

    * **Windows**：`C:\Users\你的用户名\.codex\auth.json`
    * **macOS / Linux**：`~/.codex/auth.json`

    写入 codex 分组密钥：

    ```json auth.json icon=file-code theme={null}
    {
      "OPENAI_API_KEY": "替换为您的 codex 分组 API Key"
    }
    ```
  </Step>

  <Step title="重启并验证">
    重启 ChatGPT(Codex) 客户端，发送一条测试消息，并在 [使用日志](https://globalai.vip/usage-logs/common) 中确认调用记录已生成。
  </Step>
</Steps>

## 在 VS Code 中使用

上述任一方式生效后，在 VS Code 扩展市场安装官方 Codex 插件，即可在 IDE 中直接调用 Global AI。

## 排查

<AccordionGroup>
  <Accordion title="调用报鉴权失败">
    确认使用的是 **codex 分组** 令牌，而非其他模型厂商的令牌。可以在 [globalai.vip/keys](https://globalai.vip/keys) 编辑令牌查看其分组。
  </Accordion>

  <Accordion title="模型名找不到">
    模型 ID 可能随平台调整而更新，请以 [globalai.vip/pricing](https://globalai.vip/pricing) 中显示的 Codex 相关模型 ID 为准。
  </Accordion>
</AccordionGroup>

## 参考链接

* [ChatGPT(Codex) 官方页面](https://openai.com/zh-Hans-CN/codex/)
* [Global AI 模型定价](https://globalai.vip/pricing)


## Related topics

- [Claude Code 接入 Global AI：CC Switch 与手动配置](/zh/clients/claude-code.md)
- [Global AI 客户端接入总览：常用参数与选型](/zh/clients/overview.md)
- [ChatBox 接入 Global AI：桌面与手机端配置](/zh/clients/chatbox.md)
- [OpenCode 与 CC-Switch 接入 Global AI 指南](/zh/clients/opencode.md)
- [ChatWise 接入 Global AI：多提供商统一配置指南](/zh/clients/chatwise.md)
