codex-gateway

Original🇺🇸 English
Translated

Use when the user wants to query the Codex Supergraph but $CODEX_API_KEY is not set. Pays per query via the MPP 402 challenge flow. Only supports queries, not mutations or subscriptions.

3installs
Added on

NPX Install

npx skill4agent add codex-data/skills codex-gateway

Tags

Translated version includes tags in frontmatter

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>

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.

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.

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.

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