codex-gateway
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCodex 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 | |
| Opt-in header | |
| Credential header | |
使用此技能可通过 MPP 挑战流程,在无 API 密钥的情况下访问 Codex Supergraph。
| 项 | 说明 |
|---|---|
| HTTP 端点 | |
| 可选启用头 | |
| 凭证头 | |
How it works
工作原理
Every MPP request MUST include the header . Without it the server will not recognize the request as MPP and will not return the 402 challenge — the request will simply fail. This header is required on both the initial challenge request and the credential retry.
X-Codex-Payment: mpp- Send a GraphQL query with (no credential).
X-Codex-Payment: mpp - Server returns with
402 Payment Requiredchallenges.WWW-Authenticate: Payment ... - Client solves one challenge and retries with both and
X-Codex-Payment: mpp.Authorization: Payment <credential> - Server returns GraphQL data + header.
Payment-Receipt
每个 MPP 请求都必须包含头 。 缺少该头的话,服务器不会将请求识别为 MPP 请求,也不会返回 402 挑战——请求会直接失败。该头在初始挑战请求和凭证重试请求中都是必需的。
X-Codex-Payment: mpp- 发送带有 的 GraphQL 查询(无凭证)。
X-Codex-Payment: mpp - 服务器返回 响应,附带
402 Payment Required挑战信息。WWW-Authenticate: Payment ... - 客户端完成其中一个挑战,并重试请求,同时携带 和
X-Codex-Payment: mpp头。Authorization: Payment <credential> - 服务器返回 GraphQL 数据以及 头。
Payment-Receipt
Constraints
限制条件
- Query only. Mutations and subscriptions return in MPP mode.
403 - 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 密钥或承载令牌,API 身份验证会优先生效。
- 请勿引用旧版控制台的注册/充值/余额支付端点。
Challenge flow
挑战流程
- 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: with multiple challenges.
402 Payment RequiredWWW-Authenticate: Payment ...- 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 + header.
Payment-Receipt- 首次请求(尚未有凭证):
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 RequiredWWW-Authenticate: Payment ...- 使用已完成挑战的凭证重试:
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-ReceiptRules
规则
- Always include on every MPP request. This is the most common mistake — without it, MPP does not activate.
X-Codex-Payment: mpp - Never print raw credentials.
- Only use MPP for operations.
query - For available GraphQL operations and endpoint selection heuristics, see the skill.
codex-supergraph
- 所有 MPP 请求务必包含 头。 这是最常见的错误——缺少该头的话,MPP 不会激活。
X-Codex-Payment: mpp - 切勿打印原始凭证。
- 仅将 MPP 用于 操作。
query - 有关可用的 GraphQL 操作和端点选择规则,请查看 技能。
codex-supergraph
References
参考资料
| File | Purpose |
|---|---|
| references/mpp-flow.md | Auth matrix, challenge details, error codes |
| references/mpp-templates.md | MPP curl templates |
| references/wallets.md | Wallet setup: tempo wallet/request (Tempo) and awal (Base) |
| 文件 | 用途 |
|---|---|
| references/mpp-flow.md | 身份验证矩阵、挑战详情、错误代码 |
| references/mpp-templates.md | MPP curl 模板 |
| references/wallets.md | 钱包设置:Tempo 钱包/请求(Tempo)和 awal(Base) |