以下接口面向第三方集成开放,全部无需 API Key,只需 CDK 即可调用。适合自建兑换页、机器人、自动化脚本等场景。
__BASE__
获取当前开放的计划及其可兑换库存(库存只统计后台 admin 账户的可用容量)。无需任何参数。
{
"plans": [
{
"plan_type": "plus",
"plan_label": "Plus",
"enabled": true,
"region": "US",
"region_label": "美国",
"currency": "USD",
"stock": 12,
"redeemable": 12
}
],
"backend_cards_available": 5,
"updated_at": "2026-07-01T00:00:00Z"
}
curl __BASE__/api/inventory
查询单个 CDK 的计划、状态以及当前是否可兑换。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
code | string | 是 | CDK 充值码 |
{
"plan_type": "plus",
"plan_label": "Plus",
"status": "active",
"redeemed_by": "",
"redeemed_at": null,
"enabled": true,
"stock": 12,
"redeemable": true
}
curl "__BASE__/api/cdk-info?code=PLUS-XXXX-XXXX-XXXX-XXXX"
提交一个 CDK 充值任务(异步执行)。返回 task_id,再通过任务查询接口轮询结果。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
cdk_code | string | 是 | CDK 充值码 |
session | string | 是 | 要充值的 ChatGPT 账号的 session JSON 或 access token(个人账户,非 Team/工作区) |
region | string | 否 | PH 菲区银行卡支付(默认);BO(兼容代码)谷歌 Token 重放(仅 Plus CDK,Session 必须含 account_id) |
{
"task_id": "rec_60a14efb72d7",
"message": "CDK 充值任务已提交",
"cdk_code": "PLUS-XXXX-XXXX-XXXX-XXXX",
"plan_type": "plus",
"region": "BO",
"user_email": "user@example.com"
}
curl -X POST __BASE__/api/redeem \
-H "Content-Type: application/json" \
-d '{"cdk_code":"PLUS-XXXX-XXXX-XXXX-XXXX","session":"<session JSON>","region":"BO"}'
查询充值任务状态。需带上发起充值时使用的 CDK 作为访问凭证(防止越权查询他人记录)。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
task_id | string (path) | 是 | /api/redeem 返回的 task_id |
cdk_code | string (query) | 是 | 对应的 CDK 充值码 |
manual_pending / queued / running / success / failed
{
"status": {
"id": "rec_60a14efb72d7",
"status": "success",
"result": "充值成功",
"plan_type": "plus",
"user_email": "user@example.com",
"error_type": null,
"attempts": 1
}
}
curl "__BASE__/api/task/rec_60a14efb72d7?cdk_code=PLUS-XXXX-XXXX-XXXX-XXXX"
批量更换尚未使用的 CDK:旧码立即失效并返回对应新码。单次最多 200 个。
注意:该接口会使旧 CDK 立即作废,请谨慎对外开放,建议仅在受信任的场景下使用。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
cdk_codes | string[] | 是 | 要更换的旧 CDK 列表 |
{
"items": [
{
"ok": true,
"old_cdk_code": "PLUS-OLD0-...",
"cdk_code": "PLUS-NEW1-...",
"plan_type": "plus"
}
]
}
curl -X POST __BASE__/api/replace-bulk \
-H "Content-Type: application/json" \
-d '{"cdk_codes":["PLUS-OLD0-XXXX-XXXX-XXXX"]}'
健康检查,返回前台与后端 admin_api 的连通状态。
curl __BASE__/api/health
/api/admin/*:卡、CDK、用户、代理、付款信息、设置、记录等)需要管理员登录,不对外开放。请勿将管理端口暴露到公网。