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

# CodeGPT

CodeGPT 是运行在 VS Code 中的 AI 编码助手扩展，支持 Chat 与 Agent。通过 Custom Provider 的 OpenAI 兼容接口，可接入 Step Plan 模型进行对话和代码修改。

## 接入条件

* 已安装 VS Code 和 CodeGPT 扩展，扩展标识为 `danielsanmedium.dscodegpt`。配置步骤对应 CodeGPT 3.24.73。
* 已登录 CodeGPT 账号，可访问模型管理中的 Local / Custom 配置。
* [Step Plan 订阅](https://platform.stepfun.com/step-plan)有效、额度可用，且具备所用模型的调用权限。
* 已在 [StepFun 开放平台密钥管理](https://platform.stepfun.com/interface-key)页面创建 API Key。

## 配置连接

1. 打开 CodeGPT 面板，进入 Manage AI Models。
2. 选择 Local，再选择 Custom (any OpenAI-compatible server)。
3. 填写连接参数。

| 配置项 | 填写内容 |
| - | - |
| Base URL / endpoint | `https://api.stepfun.com/step_plan/v1` |
| API Key | StepFun API Key |

CodeGPT 自动在 Base URL 后追加 `/chat/completions`。上述地址使用 Step Plan 订阅额度。

4. 点击 Test。显示 `Connected` 并加载模型列表后，选择 `step-5-preview`。
5. 点击 Save & close 保存。
6. 在聊天模型选择器中选择 Custom 下的 `step-5-preview`，新建对话。

Custom Provider 的地址、密钥和模型通过模型管理面板配置。

## 验证接入

### 验证对话

在 Chat 中输入：

```text theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
请只回复 OK。
```

预期返回 `OK`。

### 验证工具调用

在安装了 Python 的独立测试目录中创建 `README.md`，内容为 `CodeGPT Step Plan test`，并在 VS Code 中打开该目录。

切换到 Agent 模式，确认仍选中 Custom 下的 `step-5-preview`，输入：

```text theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
读取 README.md，创建 hello.py，输出 Hello, StepFun!。
使用本机可用的 Python 解释器运行 hello.py，并汇报执行命令和输出。
不要修改其他文件。
```

按扩展提示授权文件操作和命令执行，核对工具记录、生成的 `hello.py` 和 `Hello, StepFun!` 运行输出。

### 核对用量

在 [StepFun 开放平台](https://platform.stepfun.com)的使用详情中，按请求时间核对模型 ID 和计费来源，确认调用使用 Step Plan。

## 常见问题

<AccordionGroup>
  <Accordion title="Q: Test 连接失败怎么办？">
    核对 Base URL、API Key 和网络连接。地址应为 `https://api.stepfun.com/step_plan/v1`，密钥应属于对应平台账号。修改后重新点击 Test。
  </Accordion>

  <Accordion title="Q: 模型列表为空或没有目标模型怎么办？">
    确认 Test 已显示 `Connected`，并检查账号的 Step Plan 订阅与模型权限。重新测试连接后选择模型。
  </Accordion>

  <Accordion title="Q: 如何确认使用的是 Step 模型？">
    模型选择器中选择 Custom 下的 `step-5-preview`，并在 StepFun 开放平台的使用详情中核对本次请求的模型及计费来源。
  </Accordion>

  <Accordion title="Q: Chat 正常，但 Agent 无法执行任务怎么办？">
    确认已切换到 Agent 模式并打开项目目录，检查文件和终端权限。Python 示例还需要本机具有可用的 Python 解释器。
  </Accordion>
</AccordionGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.