API KEY ANALYTICS

API Key 工作台

输入 API Key 即可查看调用、额度和模型消耗;页面不会存储你的 Key。

Codex 使用教程

跟着这个教程,你可以轻松在自己的电脑上安装并使用 Codex。

1 安装 Node.js 环境

Codex 需要 Node.js 环境才能运行。

方法一:官网下载(推荐)

  1. 打开浏览器访问 nodejs.org
  2. 点击 "LTS" 版本进行下载(推荐长期支持版本)
  3. 下载完成后双击 .msi 文件
  4. 按照安装向导完成安装,保持默认设置即可

方法二:使用包管理器

如果你安装了 Chocolatey 或 Scoop,可以使用命令行安装:

# 使用 Chocolatey
choco install nodejs
# 或使用 Scoop
scoop install nodejs

Windows 注意事项

  • 建议使用 PowerShell 而不是 CMD
  • 如果遇到权限问题,尝试以管理员身份运行
  • 某些杀毒软件可能会误报,需要添加白名单

验证安装是否成功

安装完成后,打开终端,输入以下命令:

node --version
npm --version

如果显示版本号,说明安装成功了!


2 按使用场景配置

不同客户端需要填不同的 Base URL。Codex CLI / Codex Desktop 使用 Responses 通道;IDE 插件和你自己的程序通常使用 OpenAI Chat Completions 兼容通道。Codex Desktop 请优先使用 experimental_bearer_token 写在用户级 config.toml,避免新建 session 时拿不到 OPENAI_API_KEY。

Codex CLI / Codex IDE

用 Codex 官方客户端时选 Responses 通道,Base URL 不带 /v1;key 直接写 experimental_bearer_token,避免新 session 缺环境变量。

base_url = "https://sse-dev.api.v2.crowdcore.com/openai"
wire_api = "responses"
experimental_bearer_token = "后台创建的API密钥"
model = "gpt-5.5"

普通 IDE 插件

Cursor、Continue、Cline 等 OpenAI-compatible 配置通常填这些值。

Provider:OpenAI Compatible
Base URL:https://sse-dev.api.v2.crowdcore.com/openai/v1
API Key:cr_xxxxxxxxxx
Model:gpt-5.5
Endpoint:chat/completions

CC Switch Full URL

启用 full URL mode 时,必须启动 CC Switch routing service,并给该进程注入 OPENAI_API_KEY。

Base URL:https://sse-dev.api.v2.crowdcore.com/openai/v1
API Key env:OPENAI_API_KEY=cr_xxxxxxxxxx
Health check:/openai/v1

Start routing service first

自己写程序

OpenAI SDK 使用 /openai/v1,代码里调用 chat.completions。

baseURL: "https://sse-dev.api.v2.crowdcore.com/openai/v1"
apiKey: "cr_xxxxxxxxxx"
model: "gpt-5.5"
reasoning_effort: "high"

直接调 Responses API

需要 Responses 语义时用 /openai/responses,适合 Codex 风格请求。

POST https://sse-dev.api.v2.crowdcore.com/openai/responses
Authorization: Bearer cr_xxxxxxxxxx
model: gpt-5.5
input: "..."

CC Switch:Full URL Routing Mode

CC Switch 不是只读取 Codex 的 auth.json。启用 full URL connection mode 时,请先启动它的 routing service,并确保 routing service 进程环境里有 OPENAI_API_KEY。

Base URL:https://sse-dev.api.v2.crowdcore.com/openai/v1
API Key:OPENAI_API_KEY=cr_xxxxxxxxxx
Endpoint:/chat/completions or /responses

❗ 注意: 如果 CC Switch 显示 Missing environment variable: OPENAI_API_KEY,说明它的 routing service 没拿到环境变量;请在 CC Switch 的 provider/env 设置或启动命令里配置,而不是只写 %USERPROFILE%\.codex\auth.json。


系统限制与排队顺序

请求不是直接打到某个上游账号,而是先经过容量保护、资源池保护和 API Key 限制。超过对应容量时会进入队列;只有通过这些限制后,系统才选择具体上游账号。

1

Global Capacity Guard

控制总池稳定可售容量,例如 60M TPM / 18000 TPS-token;超过总容量先排队。

2

Pool Guard

按资源池隔离容量,例如 shared-dev-pool、startup-pool、enterprise-pool。

3

Package / Key Guard

每个 API Key 仍有自己的 TPM、RPM、并发数和队列上限。

4

Account Scheduler

通过前面三层限制后,最后才调度到具体上游账号。


Codex CLI / Codex Desktop:配置文件 config.toml

在 %USERPROFILE%\.codex\config.toml 文件开头添加以下配置:

model = "gpt-5.5"
model_provider = "crs-aws"
model_reasoning_effort = "high"
disable_response_storage = true
preferred_auth_method = "apikey"

[model_providers.crs-aws]
name = "crs-aws"
base_url = "https://sse-dev.api.v2.crowdcore.com/openai"
wire_api = "responses"
experimental_bearer_token = "后台创建的API密钥"
requires_openai_auth = true

一键写入命令(PowerShell):

New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.codex" | Out-Null; "model = `"gpt-5.5`"`nmodel_provider = `"crs-aws`"`nmodel_reasoning_effort = `"high`"`ndisable_response_storage = true`npreferred_auth_method = `"apikey`"`n`n[model_providers.crs-aws]`nname = `"crs-aws`"`nbase_url = `"https://sse-dev.api.v2.crowdcore.com/openai`"`nwire_api = `"responses`"`nexperimental_bearer_token = `"后台创建的API密钥`"`nrequires_openai_auth = true" | Set-Content -Path "$env:USERPROFILE\.codex\config.toml" -Force

不推荐再依赖 auth.json 环境变量

推荐把 key 直接写进用户级 %USERPROFILE%\.codex\config.toml 的 provider 配置。下面的 auth.json 只作为兼容旧版本/其他工具的备用方案。

{
  "OPENAI_API_KEY": "后台创建的API密钥"
}

自己写程序:OpenAI SDK 调用

在程序里按 OpenAI Chat Completions 兼容方式使用,Base URL 填 https://sse-dev.api.v2.crowdcore.com/openai/v1 。

import OpenAI from "openai"

const client = new OpenAI({
  apiKey: "cr_xxxxxxxxxx",
  baseURL: "https://sse-dev.api.v2.crowdcore.com/openai/v1"
})

const completion = await client.chat.completions.create({
  model: "gpt-5.5",
  messages: [{ role: "user", content: "Return exactly OK." }],
  reasoning_effort: "high",
  stream: false
})

console.log(completion.choices[0].message.content)

curl 调用示例

Chat Completions 非流式

最常见的 OpenAI 兼容调用,适合 SDK、后端服务和普通脚本。

curl https://sse-dev.api.v2.crowdcore.com/openai/v1/chat/completions \
  -H "Authorization: Bearer cr_xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.5","messages":[{"role":"user","content":"Return exactly OK."}],"reasoning_effort":"high","stream":false}'

Chat Completions 流式

IDE、聊天界面和长输出场景一般会使用 stream: true。

curl -N https://sse-dev.api.v2.crowdcore.com/openai/v1/chat/completions \
  -H "Authorization: Bearer cr_xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.5","messages":[{"role":"user","content":"Return exactly OK."}],"reasoning_effort":"high","stream":true}'

Responses API

Codex/Responses 风格请求,Base URL 不带 /v1。

curl https://sse-dev.api.v2.crowdcore.com/openai/responses \
  -H "Authorization: Bearer cr_xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.5","input":"Return exactly OK.","reasoning":{"effort":"high"},"store":false}'

查看可用模型

用于确认客户端能拿到模型列表。

curl https://sse-dev.api.v2.crowdcore.com/openai/v1/models \
  -H "Authorization: Bearer cr_xxxxxxxxxx"

提示: 请将示例中的 cr_xxxxxxxxxx 替换为您的实际 API 密钥。模型可填 gpt-5.5 或 gpt-5.4;思考强度支持 low / medium / high / xhigh。