codex-gateway

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Codex Machine Payment Protocol (MPP)

Codex机器支付协议(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>
当您没有API密钥时,可通过MPP挑战流程使用此技能访问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 both
    X-Codex-Payment: mpp
    and
    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. 客户端完成一项挑战后,重新发送请求,同时携带
    X-Codex-Payment: mpp
    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.
  • 仅支持查询。在MPP模式下,变更(mutation)和订阅(subscription)操作会返回
    403
    状态码。
  • 如果同时存在有效的API密钥或Bearer令牌,则API身份验证优先生效。

Rules

规则

  • Never print raw credentials.
  • Only use MPP for
    query
    operations.
  • Before constructing any query, read
    references/query-templates.md
    below for the correct GraphQL schema. Do not guess query or field names.
  • 切勿打印原始凭证。
  • 仅对
    query
    操作使用MPP。
  • 在构建任何查询之前,请阅读下方的
    references/query-templates.md
    以获取正确的GraphQL schema。请勿猜测查询或字段名称。

References

参考文件

FilePurpose
../codex-supergraph/references/query-templates.mdGraphQL query schema and examples — read before constructing queries
../codex-supergraph/references/gotchas.mdCommon query failure points
references/gotchas.mdMPP-specific failure points
rules/wallets.mdWallet setup: tempo wallet/request (Tempo)
references/mpp-flow.mdAuth matrix, challenge details, error codes
文件用途
../codex-supergraph/references/query-templates.mdGraphQL查询schema及示例 — 构建查询前请务必阅读
../codex-supergraph/references/gotchas.md常见查询失败点
references/gotchas.mdMPP特有的失败点
rules/wallets.md钱包设置:Tempo钱包/请求(Tempo)
references/mpp-flow.md身份验证矩阵、挑战详情、错误代码