Docs
Refer friends. Keep the rewards coming!Your friend can unlock up to 10M tokens · earn up to 30% revenue share.
+500K TokensGenerate link

OpenAI (Archive)

Archived original-language source from the legacy CrabClaw docs. This page is intentionally not machine-translated.

OpenAI 提供 GPT 模型的开发者 API。Codex 支持 ChatGPT 登录(订阅访问)或 API Key 登录(按量计费)。Codex 云端需要 ChatGPT 登录。

方式 A:OpenAI API Key(OpenAI Platform)

适用场景: 直接 API 访问和按量计费。 从 OpenAI 管理面板获取 API Key。

CLI 设置

bash
crabclaw onboard --auth-choice openai-api-key
# 或非交互模式
crabclaw onboard --openai-api-key "$OPENAI_API_KEY"
crabclaw onboard --auth-choice openai-api-key
# 或非交互模式
crabclaw onboard --openai-api-key "$OPENAI_API_KEY"

配置示例

json5
{
  env: { OPENAI_API_KEY: "sk-..." },
  agents: { defaults: { model: { primary: "openai/gpt-5.1-codex" } } },
}
{
  env: { OPENAI_API_KEY: "sk-..." },
  agents: { defaults: { model: { primary: "openai/gpt-5.1-codex" } } },
}

方式 B:OpenAI Code(Codex)订阅

适用场景: 使用 ChatGPT/Codex 订阅访问而非 API Key。 Codex 云端需要 ChatGPT 登录,Codex CLI 支持 ChatGPT 或 API Key 登录。

CLI 设置(Codex OAuth)

bash
# 在向导中运行 Codex OAuth
crabclaw onboard --auth-choice openai-codex

# 或直接运行 OAuth
crabclaw models auth login --provider openai-codex
# 在向导中运行 Codex OAuth
crabclaw onboard --auth-choice openai-codex

# 或直接运行 OAuth
crabclaw models auth login --provider openai-codex

配置示例(Codex 订阅)

json5
{
  agents: { defaults: { model: { primary: "openai-codex/gpt-5.3-codex" } } },
}
{
  agents: { defaults: { model: { primary: "openai-codex/gpt-5.3-codex" } } },
}

注意事项

  • 模型引用始终使用 provider/model 格式(参见 模型概念)。
  • 认证详情与复用规则参见 OAuth 概念