Skip to content

1.4h OpenAI(GPT-5.2 / Codex)

预计时间:10 分钟

OpenAI 是 ChatGPT 背后的公司,提供目前最强的 AI 模型。

学完你能做什么

  • 用 ChatGPT 订阅直接登录 OpenCode
  • 或用 API Key 连接 OpenAI
  • 使用 GPT-5.2、GPT-5.2-Codex 等最新模型

两种登录方式

方式适合谁优点
ChatGPT 订阅(推荐)已有 Plus/Pro 会员直接用,不用额外花钱
API Key没有订阅的用户按量付费,用多少花多少

方式一:ChatGPT 订阅登录(推荐)

跟我做

  1. 启动 OpenCode:opencode
  2. 输入:/connect
  3. 选择 OpenAI,然后选择 ChatGPT Plus/Pro
  4. 浏览器授权:用你的 ChatGPT 账号登录并授权

方式二:API Key 登录

跟我做

  1. 注册 OpenAI 账号:https://platform.openai.com
  2. 获取 API Key:https://platform.openai.com/api-keys
  3. 充值:https://platform.openai.com/settings/organization/billing
  4. 在 OpenCode 中连接:输入 /connect,选择 OpenAI → Manually enter API Key

模型推荐

模型特点适合场景
gpt-5.2-chat-latest快速响应,日常使用问答、写文档、翻译
gpt-5.2 (Thinking)深度思考,复杂任务分析、规划、难题
gpt-5.2-codex代码专用写代码、重构、调试

GPT-5.2-Codex 详解

GPT-5.2-Codex 是专门为代码任务优化的版本,适合:

  • 长时间任务(支持上下文压缩)
  • 大规模重构
  • 代码迁移
  • 调试 bug

检查点

  • [ ] 能在 /models 里看到 OpenAI 的模型
  • [ ] 发送消息能收到 AI 回复
  • [ ] 能切换到 GPT-5.2-Codex 模型

下一步

回到 1.4 总览 选择下一条路线。