> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codex.io/llms.txt
> Use this file to discover all available pages before exploring further.

# MPP

> Enable AI agents to pay for Codex API access using the Machine Payments Protocol (MPP) over HTTP 402.

Codex supports pay-per-request access using [MPP](https://tempo.xyz/solutions/agentic-payments) (Machine Payments Protocol), an open, payment-method agnostic protocol built on HTTP 402. AI agents and scripts can query the Codex API without an API key by paying \$0.001 per request.

MPP is co-authored by [Tempo](https://tempo.xyz) and [Stripe](https://stripe.com), and the core [Payment HTTP Authentication Scheme](https://datatracker.ietf.org/doc/html/draft-ryan-httpauth-payment-01) is on the IETF standards track.

## How it works

Traditional API access requires account creation, API keys, and prepaid credits. With MPP, the flow is:

1. Send a request to the Codex API
2. The server responds with `HTTP 402 Payment Required` and a payment challenge
3. The client pays \$0.001 via USDC on Tempo
4. The server validates the payment and returns the data

No Codex account signup, no API key, no billing dashboard. Just pay and query.

<Info>
  MPP access is ideal for autonomous agents, bots, and scripts that need programmatic access without manual account setup. For human developers building apps, we still recommend [getting an API key](https://dashboard.codex.io/signup?utm_source=codex\&utm_medium=docs\&utm_campaign=mpp) for the best experience.
</Info>

## Pricing

|                      |                            |
| -------------------- | -------------------------- |
| **Cost per request** | \$0.001 USDC               |
| **Payment network**  | [Tempo](https://tempo.xyz) |
| **Payment token**    | USDC                       |

<Tip>
  Additional payment networks and Stripe payment methods (cards, wallets) are coming soon.
</Tip>

## Quick start

The fastest way is to install the [Codex skill](/agents/codex-skills):

```bash theme={null}
npx skills add Codex-Data/skills -g --yes
```

Then follow these steps to get started:

1. Ask the agent to use Codex to get the top 25 trending tokens (or whatever your query is)
2. It will then try to execute the query using the API key. If it fails, it will fallback to MPP.
   * Or you can just ask it to use MPP directly
3. It will then install Tempo's `tempo` CLI to manage your Tempo wallet
4. It will then redirect you to the Tempo website to authorize access
5. There, you can either fund your new wallet (from Base, Solana, Ethereum, etc), or use an existing one. **Your new wallet must have at least 1 USDC on Tempo to continue.**
6. Once funded, you press Continue and you will be prompted to authorize Tempo to access your wallet
7. Once authorized, your agent will attempt to run the query using MPP

<img src="https://mintcdn.com/codex-dfdf2708/L2P37povXDt2tEJI/images/agents/tempo-auth.png?fit=max&auto=format&n=L2P37povXDt2tEJI&q=85&s=53f13723c71b245eab407060f07c950f" alt="Tempo wallet authorization" width="964" height="611" data-path="images/agents/tempo-auth.png" />

## Example usage

Ask your agent:

> "Get me a list of 20 dog tokens."

It will then check to see if you have provided an API key.

Assuming you have enabled MPP, the skill will guide the agent to run it to generate:

```bash theme={null}
tempo request -t -X POST \
  -H 'X-Codex-Payment: mpp' \
  --json '{"query":"query FilterTokens($phrase: String, $rankings: [TokenRanking], $limit: Int) { filterTokens(phrase: $phrase, rankings: $rankings, limit: $limit) { results { buyVolume24 sellVolume24 circulatingMarketCap liquidity txnCount24 token { info { address name symbol networkId imageThumbUrl } } } } }","variables":{"phrase":"dog","rankings":[{"attribute":"txnCount24","direction":"DESC"}],"limit":20}}' \
  https://graph.codex.io/graphql 2>&1
```

And it will return a response like this:

<Accordion title="Example Response">
  ```bash theme={null}
    data:
      filterTokens:
        results[20]:
          - buyVolume24: "86690"
            sellVolume24: "86570"
            circulatingMarketCap: "1717"
            liquidity: "1683"
            txnCount24: 47348
            token:
              info:
                address: 7LFwtPuQL2iaziWkFdzJSNyHwG7ypro24txxSz6H79c7
                name: em@doge.gov
                symbol: dogemail
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_7LFwtPuQL2iaziWkFdzJSNyHwG7ypro24txxSz6H79c7_thumb.png"
          - buyVolume24: "254789"
            sellVolume24: "243302"
            circulatingMarketCap: "5689"
            liquidity: "0"
            txnCount24: 16042
            token:
              info:
                address: 44iEvdnRkp9KZxMmsgFRMjxu8YbvRXyNdvrKbcfc8RdT
                name: Dog Eat Dog
                symbol: Dash
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_44iEvdnRkp9KZxMmsgFRMjxu8YbvRXyNdvrKbcfc8RdT_thumb_cdbe60390207.png"
          - buyVolume24: "538396"
            sellVolume24: "524541"
            circulatingMarketCap: "981"
            liquidity: "0"
            txnCount24: 16041
            token:
              info:
                address: 7QTEsUYoMBGSTyGSxm8QFk5nWqeD5ro5WVgHtH9huge9
                name: Dog's POV
                symbol: POV
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_7QTEsUYoMBGSTyGSxm8QFk5nWqeD5ro5WVgHtH9huge9_thumb_efdd1321689b.png"
          - buyVolume24: "248973"
            sellVolume24: "244819"
            circulatingMarketCap: "16855"
            liquidity: "0"
            txnCount24: 13800
            token:
              info:
                address: HQkbFLLhCMj8x4p1AwzA8FbzxomBSkZkTT7fpvqDkxBt
                name: Dog's POV
                symbol: POV
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_HQkbFLLhCMj8x4p1AwzA8FbzxomBSkZkTT7fpvqDkxBt_thumb_efdd1321689b.png"
          - buyVolume24: "228547"
            sellVolume24: "220835"
            circulatingMarketCap: "20608"
            liquidity: "0"
            txnCount24: 10239
            token:
              info:
                address: CBAdBWQ8cSM2YqXxTk4GTs9VRWig8rn6GzgVuvt1D4hx
                name: Advice Dog
                symbol: DOG
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_CBAdBWQ8cSM2YqXxTk4GTs9VRWig8rn6GzgVuvt1D4hx_thumb_97699a101f77.png"
          - buyVolume24: "235342"
            sellVolume24: "224658"
            circulatingMarketCap: "6297"
            liquidity: "0"
            txnCount24: 10009
            token:
              info:
                address: 29c1SNtRS79THqcW8qyt4igoYC9PBXhHuAj4nbyBk5p6
                name: DOGE
                symbol: DOGE
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_29c1SNtRS79THqcW8qyt4igoYC9PBXhHuAj4nbyBk5p6_thumb_17476c0fd6b9.png"
          - buyVolume24: "141184"
            sellVolume24: "123372"
            circulatingMarketCap: "21912"
            liquidity: "0"
            txnCount24: 9844
            token:
              info:
                address: QNvxZCtHhgbWFM9qCvyKRgB9m5AzsiQ6mg37BksTu3Q
                name: DOGE
                symbol: DOGE
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_QNvxZCtHhgbWFM9qCvyKRgB9m5AzsiQ6mg37BksTu3Q_thumb_17476c0fd6b9.png"
          - buyVolume24: "155536"
            sellVolume24: "138576"
            circulatingMarketCap: "3398"
            liquidity: "0"
            txnCount24: 8840
            token:
              info:
                address: 2YEaca3EXNppXobJFgYLdb8sFEx7NTMPJX2D7TWrZXHm
                name: DOGE
                symbol: DOGE
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_2YEaca3EXNppXobJFgYLdb8sFEx7NTMPJX2D7TWrZXHm_thumb_17476c0fd6b9.png"
          - buyVolume24: "147565"
            sellVolume24: "134144"
            circulatingMarketCap: "4791"
            liquidity: "0"
            txnCount24: 7769
            token:
              info:
                address: 68tHc9SKokmimJgsC14wEn28T8hk6RTjufMQszMdCpfe
                name: DOGE
                symbol: DOGE
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_68tHc9SKokmimJgsC14wEn28T8hk6RTjufMQszMdCpfe_thumb_17476c0fd6b9.png"
          - buyVolume24: "55973"
            sellVolume24: "56836"
            circulatingMarketCap: "25633"
            liquidity: "6669"
            txnCount24: 7008
            token:
              info:
                address: F2c9NYX7YKXnXrdRCTEH1gbLYoubc6AVWZJdcxkypump
                name: Dark Doge
                symbol: DarkDoge
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_F2c9NYX7YKXnXrdRCTEH1gbLYoubc6AVWZJdcxkypump_1732216636_thumb.png"
          - buyVolume24: "862735"
            sellVolume24: "799848"
            circulatingMarketCap: "57214767"
            liquidity: "4969132"
            txnCount24: 6225
            token:
              info:
                address: MEW1gQWJ3nEXg2qgERiKu7FAFj79PHvQVREQUzScPP5
                name: cat in a dogs world
                symbol: MEW
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_MEW1gQWJ3nEXg2qgERiKu7FAFj79PHvQVREQUzScPP5_thumb_11d957ce-c1ae-4d0a-a460-7b923f40fb76.png"
          - buyVolume24: "69913"
            sellVolume24: "66098"
            circulatingMarketCap: "117"
            liquidity: "0"
            txnCount24: 5781
            token:
              info:
                address: 5pB2eczikYMfy5fHxEgDhnGBc8V7YD1doaxecF2Q5Jcr
                name: Dog's POV
                symbol: POV
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_5pB2eczikYMfy5fHxEgDhnGBc8V7YD1doaxecF2Q5Jcr_thumb_efdd1321689b.png"
          - buyVolume24: "58304"
            sellVolume24: "54016"
            circulatingMarketCap: "1695"
            liquidity: "0"
            txnCount24: 5622
            token:
              info:
                address: 2dDvi5QpiR1UxzDwJX1t1szMbSyTq9Ldkevgn5DmUKWH
                name: DOGE
                symbol: DOGE
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_2dDvi5QpiR1UxzDwJX1t1szMbSyTq9Ldkevgn5DmUKWH_thumb_17476c0fd6b9.png"
          - buyVolume24: "93700"
            sellVolume24: "89610"
            circulatingMarketCap: "16680"
            liquidity: "0"
            txnCount24: 5122
            token:
              info:
                address: 7BWKvpK7RjEuRxoZnQ9yCePgathaY2F6gRrdTpknsXkJ
                name: Dog Eat Dog
                symbol: Dash
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_7BWKvpK7RjEuRxoZnQ9yCePgathaY2F6gRrdTpknsXkJ_thumb_cdbe60390207.png"
          - buyVolume24: "78378"
            sellVolume24: "154758"
            circulatingMarketCap: "72139728"
            liquidity: "4366889"
            txnCount24: 4911
            token:
              info:
                address: "0xc748673057861a797275cd8a068abb95a902e8de"
                name: Baby Doge Coin
                symbol: BabyDoge
                networkId: 56
                imageThumbUrl: "https://token-media.defined.fi/56_0xc748673057861a797275cd8a068abb95a902e8de_thumb_bac0895ae46f.png"
          - buyVolume24: "255927"
            sellVolume24: "257210"
            circulatingMarketCap: "1878610"
            liquidity: "80782"
            txnCount24: 4781
            token:
              info:
                address: 6iA73gWCKkLWKbVr8rgibV57MMRxzsaqS9cWpgKBpump
                name: what the dog doing?
                symbol: 我的刀盾
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_6iA73gWCKkLWKbVr8rgibV57MMRxzsaqS9cWpgKBpump_thumb_63b436b284e0.png"
          - buyVolume24: "58891"
            sellVolume24: "52566"
            circulatingMarketCap: "1991"
            liquidity: "0"
            txnCount24: 4630
            token:
              info:
                address: E3ZKPeFCEZ5syUK6tdJBiGKhJQCo6CnJSR88kbiaJF9b
                name: DOGE
                symbol: DOGE
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_E3ZKPeFCEZ5syUK6tdJBiGKhJQCo6CnJSR88kbiaJF9b_thumb_17476c0fd6b9.png"
          - buyVolume24: "426486"
            sellVolume24: "436956"
            circulatingMarketCap: "1426107"
            liquidity: "83658"
            txnCount24: 4186
            token:
              info:
                address: "0x640c04ca09c5c5140e62fef42c59e3afdbbd4444"
                name: what the dog doing?
                symbol: 我的刀盾
                networkId: 56
                imageThumbUrl: "https://token-media.defined.fi/56_0x640c04ca09c5c5140e62fef42c59e3afdbbd4444_thumb_b73c93973cee.png"
          - buyVolume24: "32557"
            sellVolume24: "27629"
            circulatingMarketCap: "11200"
            liquidity: "0"
            txnCount24: 3696
            token:
              info:
                address: CSsb7SsJsayWy9ZuDcMzjLzKiUbiJr734kSoVCtUKXBc
                name: DOGE
                symbol: DOGE
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_CSsb7SsJsayWy9ZuDcMzjLzKiUbiJr734kSoVCtUKXBc_thumb_17476c0fd6b9.png"
          - buyVolume24: "42281"
            sellVolume24: "36618"
            circulatingMarketCap: "2278"
            liquidity: "0"
            txnCount24: 3523
            token:
              info:
                address: 6VM8Wp8ireGjWG18ZwPWFaRNkRXyG1aMyepjBCYrWu3b
                name: DOGE
                symbol: DOGE
                networkId: 1399811149
                imageThumbUrl: "https://token-media.defined.fi/1399811149_6VM8Wp8ireGjWG18ZwPWFaRNkRXyG1aMyepjBCYrWu3b_thumb_17476c0fd6b9.png"
  ```
</Accordion>

And then it will likely summarize the results for you, like this:

<img src="https://mintcdn.com/codex-dfdf2708/L2P37povXDt2tEJI/images/agents/dog-coins.png?fit=max&auto=format&n=L2P37povXDt2tEJI&q=85&s=810b60017c5e92b3f28af7f89fa8571b" alt="Codex Skills Summary" width="905" height="593" data-path="images/agents/dog-coins.png" />

<Info title="Warning">
  This is not an endorsement of any of these tokens, and they may be scams or rugs. Please do your own research before investing. You can also ask your agent to filter out scams.
</Info>

## Supported endpoints

MPP is available for all Codex [query endpoints](/api-reference/queries). Here are some of the most popular ones:

| Category           | Popular endpoints                                                                                                                                                                                                                                                                                             |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Token data**     | [`filterTokens`](/api-reference/queries/filtertokens), [`token`](/api-reference/queries/token), [`tokens`](/api-reference/queries/tokens), [`getTokenPrices`](/api-reference/queries/gettokenprices), [`tokenSparklines`](/api-reference/queries/tokensparklines)                                             |
| **Pair & trading** | [`filterPairs`](/api-reference/queries/filterpairs), [`listPairsForToken`](/api-reference/queries/listpairsfortoken), [`pairMetadata`](/api-reference/queries/pairmetadata), [`getDetailedPairStats`](/api-reference/queries/getdetailedpairstats), [`getTokenEvents`](/api-reference/queries/gettokenevents) |
| **Charts**         | [`getBars`](/api-reference/queries/getbars), [`getTokenBars`](/api-reference/queries/gettokenbars), [`getSymbol`](/api-reference/queries/getsymbol)                                                                                                                                                           |
| **Networks**       | [`getNetworks`](/api-reference/queries/getnetworks), [`getNetworkStatus`](/api-reference/queries/getnetworkstatus)                                                                                                                                                                                            |
| **Wallets**        | [`filterWallets`](/api-reference/queries/filterwallets), [`detailedWalletStats`](/api-reference/queries/detailedwalletstats), [`walletChart`](/api-reference/queries/walletchart), [`balances`](/api-reference/queries/balances)                                                                              |
| **Holders**        | [`holders`](/api-reference/queries/holders), [`tokenTopTraders`](/api-reference/queries/tokentoptraders)                                                                                                                                                                                                      |
| **Predictions**    | [`filterPredictionEvents`](/api-reference/queries/filterpredictionevents), [`filterPredictionMarkets`](/api-reference/queries/filterpredictionmarkets), [`filterPredictionTraders`](/api-reference/queries/filterpredictiontraders)                                                                           |

See the full [GraphQL Reference](/api-reference/queries) for all available endpoints.

The beauty with the [Codex Skills](/agents/codex-skills), however, is you don't have to worry about any of this. Just ask your agent to use MPP and it will handle everything for you.

<Warning>
  WebSocket subscriptions and webhooks are **not** available via MPP at this time.
</Warning>

<Info>
  At the moment, Codex only supports payments via MPP on the Tempo network. We will add support for other networks and payment methods in the future.
</Info>

## Learn more

* [MPP Documentation](https://docs.tempo.xyz/): Full protocol docs, SDKs, and guides
* [tempo CLI](https://docs.tempo.xyz/cli/wallet): Command-line client for making paid requests
* [Tempo](https://tempo.xyz): The network powering MPP stablecoin payments
