CHATGPT RECHARGE API

API 接入.

用一个接口,完成 ChatGPT 订阅代充。客户扫码支付或账户余额扣款,从下单到开通自动处理。

Go · Plus · ProHTTPS / JSON平台结算价 = 官方美元价 × 最新汇率

身份认证

开通 API 账户后,在「密钥」中创建代充专用密钥。使用 Bearer 认证,通过你的服务端调用。

BASE URLhttps://llmapi.pro/api/recharge/v1
Authorization: Bearer ra_your_private_key
Content-Type: application/json

密钥只在创建时完整显示,请妥善保存。只在你的服务端使用,不放进网页、App 或日志。

查询套餐与报价

先查询可用套餐与当前人民币结算价。所有金额使用整数「分」,Go、Plus、Pro 均按官方美元月费换算。

GET /products

{ "success": true, "products": [{
  "product_key": "chatgpt_go", "currency": "CNY",
  "amount_cents": 5320, "available": true,
  "official_usd": 8, "usd_cny": 6.65,
  "fx_updated_at": "2026-10-14T00:00:00Z",
  "invoice_fee_percent": 1
}] }

示例金额仅用于说明格式,真实报价以 /products 返回为准。

Go chatgpt_goPlus chatgpt_plusPro chatgpt_pro

创建代充订单

同一个下单接口,支持两种支付方式。由你的程序选择,控制台只负责账户、密钥与账务。

客户扫码

无需预充值

自定客户售价,返回支付宝二维码。确认付款后自动代充,完成后差额计入收益。

payment_mode: "alipay"
余额扣款

提交即开始办理

先充值代充余额。下单按平台报价扣款,适合已有收款流程的系统。

payment_mode: "wallet"
Node.js · 客户扫码
const base = 'https://llmapi.pro/api/recharge/v1';
const headers = { Authorization: 'Bearer ' + process.env.RECHARGE_API_KEY };
const { products } = await fetch(base + '/products', { headers }).then(r => r.json());
const product = products.find(p => p.product_key === 'chatgpt_go' && p.available);
if (!product) throw new Error('Product unavailable');
const response = await fetch(base + '/orders', {
  method: 'POST',
  headers: { ...headers, 'Content-Type': 'application/json',
    'Idempotency-Key': businessOrderId },
  body: JSON.stringify({
    product_key: product.product_key,
    session: customerSessionJson,
    payment_mode: 'alipay',
    sale_amount_cents: yourPriceCents,
    max_amount_cents: product.amount_cents
  })
});
const result = await response.json();
if (!response.ok) throw new Error(result.error?.code || 'Request failed');
// 把二维码展示给客户;重放已付款订单时 payment 可能为 null。
showPaymentQR(result.payment?.qr_code);
// 每 5–10 秒查询,status=completed 才表示代充完成。
const status = await fetch(base + '/orders/' + result.order.recharge_no,
  { headers }).then(r => r.json());

customerSessionJson 是完整 Session JSON 的字符串,须来自客户授权;不是 JSON 对象或只有 accessToken。密钥与 Session 均不得放进日志或前端源码。

扫码售价 sale_amount_cents 不得低于平台报价;max_amount_cents 限制平台基础结算价。可选 invoice_requested: true 会在客户售价上加收 1% 开票费用,费用不计入收益。订单创建后锁定金额,后续汇率变动不影响本单。

改用余额扣款
{
  "product_key": "chatgpt_go",
  "session": "{...}",
  "payment_mode": "wallet",
  "max_amount_cents": 5320
}

省略 sale_amount_cents,payment_mode 设为 wallet(默认也是 wallet)。此模式的 max_amount_cents 包含可选的 1% 开票费用。余额不足返回 402,不创建订单。

响应
{ "success": true, "replayed": false,
  "order": {
    "recharge_no": "RC...", "client_order_id": "your-order-001",
    "status": "awaiting_payment", "payment_mode": "alipay",
    "payment_status": "pending", "amount_cents": 6000,
    "settlement_cents": 5320, "profit_cents": 680
  },
  "payment": {
    "status": "pending", "qr_url": "https://qr.alipay.com/...",
    "qr_code": "data:image/png;base64,...", "amount_cents": 6000,
    "expires_at": "2026-10-14T00:30:00Z"
  }
}

查询订单状态

HTTP 201 仅代表订单已受理。每 5–10 秒查询一次,以订单状态为准;支付成功不等于代充完成。扫码有效期约 30 分钟,过期后不要复用二维码。

GET /orders/{recharge_no_or_client_order_id}
GET /orders?before={cursor}
待付款→等待处理→处理中→已完成

代充完成后,客户实付金额减去平台结算金额计入收益。失败订单不产生收益;后续退款会冲回对应收益。

每笔业务订单使用固定 Idempotency-Key(8–64 位)。超时或 5xx 必须原请求、原请求号重试;不要换号下单。重试返回 replayed: true。同一请求号改变参数会返回 409。每账户每分钟最多 120 次调用。

异常处理

查询订单的 required_action、customer_message 和 submitted_at。按提示补充 Session 或申请退款,不要为同一笔已付款订单重新下单。

POST /orders/{recharge_no}/credentials
{ "session": "{...}", "expected_submitted_at": "...",
  "confirm_account_change": true }

POST /orders/{recharge_no}/refund
{ "confirm_refund": true, "expected_submitted_at": "..." }

expected_submitted_at 使用查询返回的原值。只有明确要求更换账号时才传 confirm_account_change: true。自助退款只支持系统确认可退款的失败订单;不支持时返回 409,需联系客服核对。退款确认后,扫码单原路退回,余额单退回代充余额。

接口清单

方法路径用途
GET/balance可用代充余额
GET/products查询套餐与报价
POST/orders创建代充订单
GET/orders/{id}查询订单状态
GET/orders?before={cursor}分页查询订单
POST/orders/{id}/credentials异常处理
POST/orders/{id}/refund退款
错误与重试

400 参数无效;401 密钥无效;402 余额不足;403 账户未开通或暂停;409 请求号冲突、报价变化或状态冲突;429 调用过频;502 / 503 暂不可用,请原请求号重试。

BUILD WITH YOUR AGENT

让 AI 帮你接入代充

复制完整接入提示词,交给你的开发 Agent,在现有项目中接入代充业务。