agent-payments

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Codex Machine Payment Protocol (MPP)

Codex Machine Payment Protocol(MPP)

Use this skill to access the Codex Supergraph without an API key via the MPP challenge flow.
HTTP endpoint
https://graph.codex.io/graphql
Opt-in header
X-Codex-Payment: mpp
Credential header
Authorization: Payment <base64url-credential>
使用此Skill可通过MPP挑战流在无API密钥的情况下访问Codex Supergraph。
项目说明
HTTP端点
https://graph.codex.io/graphql
启用头
X-Codex-Payment: mpp
凭证头
Authorization: Payment <base64url-credential>

How it works

工作原理

  1. Send a GraphQL query with
    X-Codex-Payment: mpp
    (no credential).
  2. Server returns
    402 Payment Required
    with
    WWW-Authenticate: Payment ...
    challenges.
  3. Client solves one challenge and retries with
    Authorization: Payment <credential>
    .
  4. Server returns GraphQL data +
    Payment-Receipt
    header.
  1. 发送带有
    X-Codex-Payment: mpp
    的GraphQL查询(无需凭证)。
  2. 服务器返回
    402 Payment Required
    响应,附带
    WWW-Authenticate: Payment ...
    挑战信息。
  3. 客户端完成一项挑战后,携带
    Authorization: Payment <credential>
    重试请求。
  4. 服务器返回GraphQL数据及
    Payment-Receipt
    响应头。

Constraints

约束条件

  • Query only. Mutations and subscriptions return
    403
    in MPP mode.
  • If a valid API key or bearer token is also present, API auth takes precedence.
  • Do not reference legacy dashboard onboarding/top-up/balance payment endpoints.
  • 仅支持查询:在MPP模式下,变更(Mutations)和订阅(subscriptions)请求会返回
    403
  • 如果同时存在有效的API密钥或Bearer令牌,将优先使用API认证方式。
  • 请勿引用旧版控制台的注册/充值/余额支付端点。

Challenge flow

挑战流步骤

  1. First request (no credential yet):
bash
curl -i -sS https://graph.codex.io/graphql \
  -H "Content-Type: application/json" \
  -H "X-Codex-Payment: mpp" \
  --data-binary '{"query":"query GetNetworks { getNetworks { id name } }"}'
Expected:
402 Payment Required
with multiple
WWW-Authenticate: Payment ...
challenges.
  1. Retry with solved credential:
bash
curl -i -sS https://graph.codex.io/graphql \
  -H "Content-Type: application/json" \
  -H "X-Codex-Payment: mpp" \
  -H "Authorization: Payment <base64url-credential>" \
  --data-binary '{"query":"query GetNetworks { getNetworks { id name } }"}'
Expected: GraphQL data +
Payment-Receipt
header.
  1. 首次请求(无凭证):
bash
curl -i -sS https://graph.codex.io/graphql \
  -H "Content-Type: application/json" \
  -H "X-Codex-Payment: mpp" \
  --data-binary '{"query":"query GetNetworks { getNetworks { id name } }"}'
预期结果:返回
402 Payment Required
,附带多条
WWW-Authenticate: Payment ...
挑战信息。
  1. 携带已解决的凭证重试:
bash
curl -i -sS https://graph.codex.io/graphql \
  -H "Content-Type: application/json" \
  -H "X-Codex-Payment: mpp" \
  -H "Authorization: Payment <base64url-credential>" \
  --data-binary '{"query":"query GetNetworks { getNetworks { id name } }"}'
预期结果:返回GraphQL数据及
Payment-Receipt
响应头。

Rules

规则

  • Never print raw credentials.
  • Only use MPP for
    query
    operations.
  • For available GraphQL operations and endpoint selection heuristics, see the
    codex-supergraph
    skill.
  • 切勿打印原始凭证。
  • 仅对
    query
    操作使用MPP。
  • 关于可用的GraphQL操作及端点选择规则,请查看
    codex-supergraph
    Skill。

References

参考资料

FilePurpose
references/mpp-flow.mdAuth matrix, challenge details, error codes
references/mpp-templates.mdMPP curl templates
references/wallets.mdWallet setup: tempo wallet/request (Tempo) and awal (Base)
文件用途
references/mpp-flow.md认证矩阵、挑战详情、错误码
references/mpp-templates.mdMPP curl模板
references/wallets.md钱包设置:Tempo钱包/请求(Tempo)和awal(Base)