> ## 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/draft-ryan-httpauth-payment/) 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.

> [!NOTE]
>
> 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.

## 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.

## Quick start

The fastest way is to install the [Codex skill](https://docs.codex.io/agents/codex-skills.md):

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

> [!NOTE]
>
> If the install fails with "PromptScript does not support global skill installation", name your agent, for example `npx skills add Codex-Data/skills -g -a claude-code`.

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

![Tempo wallet authorization](https://mintcdn.com/codex-dfdf2708/L2P37povXDt2tEJI/images/agents/tempo-auth.png?fit=max\&auto=format\&n=L2P37povXDt2tEJI\&q=85\&s=53f13723c71b245eab407060f07c950f)

## 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] Example Response
>
> ```bash theme={null}
>   data:
>     filterTokens:
>       results[20]:
>         - buyVolume24: "86690"
>           sellVolume24: "86570"
>           circulatingMarketCap: "1717"
>           liquidity: "1683"
>           txnCount24: 47348
>           token:
>             info:
>               address: TOKEN_ADDRESS_1
>               name: em@doge.gov
>               symbol: dogemail
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_1_thumb.png"
>         - buyVolume24: "254789"
>           sellVolume24: "243302"
>           circulatingMarketCap: "5689"
>           liquidity: "0"
>           txnCount24: 16042
>           token:
>             info:
>               address: TOKEN_ADDRESS_2
>               name: Dog Eat Dog
>               symbol: Dash
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_2_thumb_cdbe60390207.png"
>         - buyVolume24: "538396"
>           sellVolume24: "524541"
>           circulatingMarketCap: "981"
>           liquidity: "0"
>           txnCount24: 16041
>           token:
>             info:
>               address: TOKEN_ADDRESS_3
>               name: Dog's POV
>               symbol: POV
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_3_thumb_efdd1321689b.png"
>         - buyVolume24: "248973"
>           sellVolume24: "244819"
>           circulatingMarketCap: "16855"
>           liquidity: "0"
>           txnCount24: 13800
>           token:
>             info:
>               address: TOKEN_ADDRESS_4
>               name: Dog's POV
>               symbol: POV
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_4_thumb_efdd1321689b.png"
>         - buyVolume24: "228547"
>           sellVolume24: "220835"
>           circulatingMarketCap: "20608"
>           liquidity: "0"
>           txnCount24: 10239
>           token:
>             info:
>               address: TOKEN_ADDRESS_5
>               name: Advice Dog
>               symbol: DOG
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_5_thumb_97699a101f77.png"
>         - buyVolume24: "235342"
>           sellVolume24: "224658"
>           circulatingMarketCap: "6297"
>           liquidity: "0"
>           txnCount24: 10009
>           token:
>             info:
>               address: TOKEN_ADDRESS_6
>               name: DOGE
>               symbol: DOGE
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_6_thumb_17476c0fd6b9.png"
>         - buyVolume24: "141184"
>           sellVolume24: "123372"
>           circulatingMarketCap: "21912"
>           liquidity: "0"
>           txnCount24: 9844
>           token:
>             info:
>               address: TOKEN_ADDRESS_7
>               name: DOGE
>               symbol: DOGE
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_7_thumb_17476c0fd6b9.png"
>         - buyVolume24: "155536"
>           sellVolume24: "138576"
>           circulatingMarketCap: "3398"
>           liquidity: "0"
>           txnCount24: 8840
>           token:
>             info:
>               address: TOKEN_ADDRESS_8
>               name: DOGE
>               symbol: DOGE
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_8_thumb_17476c0fd6b9.png"
>         - buyVolume24: "147565"
>           sellVolume24: "134144"
>           circulatingMarketCap: "4791"
>           liquidity: "0"
>           txnCount24: 7769
>           token:
>             info:
>               address: TOKEN_ADDRESS_9
>               name: DOGE
>               symbol: DOGE
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_9_thumb_17476c0fd6b9.png"
>         - buyVolume24: "55973"
>           sellVolume24: "56836"
>           circulatingMarketCap: "25633"
>           liquidity: "6669"
>           txnCount24: 7008
>           token:
>             info:
>               address: TOKEN_ADDRESS_10
>               name: Dark Doge
>               symbol: DarkDoge
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_10_1732216636_thumb.png"
>         - buyVolume24: "862735"
>           sellVolume24: "799848"
>           circulatingMarketCap: "57214767"
>           liquidity: "4969132"
>           txnCount24: 6225
>           token:
>             info:
>               address: TOKEN_ADDRESS_11
>               name: cat in a dogs world
>               symbol: MEW
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_11_thumb_11d957ce-c1ae-4d0a-a460-7b923f40fb76.png"
>         - buyVolume24: "69913"
>           sellVolume24: "66098"
>           circulatingMarketCap: "117"
>           liquidity: "0"
>           txnCount24: 5781
>           token:
>             info:
>               address: TOKEN_ADDRESS_12
>               name: Dog's POV
>               symbol: POV
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_12_thumb_efdd1321689b.png"
>         - buyVolume24: "58304"
>           sellVolume24: "54016"
>           circulatingMarketCap: "1695"
>           liquidity: "0"
>           txnCount24: 5622
>           token:
>             info:
>               address: TOKEN_ADDRESS_13
>               name: DOGE
>               symbol: DOGE
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_13_thumb_17476c0fd6b9.png"
>         - buyVolume24: "93700"
>           sellVolume24: "89610"
>           circulatingMarketCap: "16680"
>           liquidity: "0"
>           txnCount24: 5122
>           token:
>             info:
>               address: TOKEN_ADDRESS_14
>               name: Dog Eat Dog
>               symbol: Dash
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_14_thumb_cdbe60390207.png"
>         - buyVolume24: "78378"
>           sellVolume24: "154758"
>           circulatingMarketCap: "72139728"
>           liquidity: "4366889"
>           txnCount24: 4911
>           token:
>             info:
>               address: "TOKEN_ADDRESS_15"
>               name: Baby Doge Coin
>               symbol: BabyDoge
>               networkId: 56
>               imageThumbUrl: "https://token-media.defined.fi/56_TOKEN_ADDRESS_15_thumb_bac0895ae46f.png"
>         - buyVolume24: "255927"
>           sellVolume24: "257210"
>           circulatingMarketCap: "1878610"
>           liquidity: "80782"
>           txnCount24: 4781
>           token:
>             info:
>               address: TOKEN_ADDRESS_16
>               name: what the dog doing?
>               symbol: 我的刀盾
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_16_thumb_63b436b284e0.png"
>         - buyVolume24: "58891"
>           sellVolume24: "52566"
>           circulatingMarketCap: "1991"
>           liquidity: "0"
>           txnCount24: 4630
>           token:
>             info:
>               address: TOKEN_ADDRESS_17
>               name: DOGE
>               symbol: DOGE
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_17_thumb_17476c0fd6b9.png"
>         - buyVolume24: "426486"
>           sellVolume24: "436956"
>           circulatingMarketCap: "1426107"
>           liquidity: "83658"
>           txnCount24: 4186
>           token:
>             info:
>               address: "TOKEN_ADDRESS_18"
>               name: what the dog doing?
>               symbol: 我的刀盾
>               networkId: 56
>               imageThumbUrl: "https://token-media.defined.fi/56_TOKEN_ADDRESS_18_thumb_b73c93973cee.png"
>         - buyVolume24: "32557"
>           sellVolume24: "27629"
>           circulatingMarketCap: "11200"
>           liquidity: "0"
>           txnCount24: 3696
>           token:
>             info:
>               address: TOKEN_ADDRESS_19
>               name: DOGE
>               symbol: DOGE
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_19_thumb_17476c0fd6b9.png"
>         - buyVolume24: "42281"
>           sellVolume24: "36618"
>           circulatingMarketCap: "2278"
>           liquidity: "0"
>           txnCount24: 3523
>           token:
>             info:
>               address: TOKEN_ADDRESS_20
>               name: DOGE
>               symbol: DOGE
>               networkId: 1399811149
>               imageThumbUrl: "https://token-media.defined.fi/1399811149_TOKEN_ADDRESS_20_thumb_17476c0fd6b9.png"
> ```

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

![Codex Skills Summary](https://mintcdn.com/codex-dfdf2708/L2P37povXDt2tEJI/images/agents/dog-coins.png?fit=max\&auto=format\&n=L2P37povXDt2tEJI\&q=85\&s=810b60017c5e92b3f28af7f89fa8571b)

> [!NOTE]
>
> 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.

## Supported endpoints

MPP is available for all Codex [query endpoints](https://docs.codex.io/api-reference/introduction.md). Here are some of the most popular ones:

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

See the full [GraphQL Reference](https://docs.codex.io/api-reference/introduction.md) for all available endpoints.

The beauty with the [Codex Skills](https://docs.codex.io/agents/codex-skills.md), 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.

> [!NOTE]
>
> 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.

## Learn more

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.