Let an AI agent or a CLI pay for HTTP APIs, data, and compute in stablecoins on Celo with buy, an x402 payment client
This page is for agent developers who want their agent, or their own scripts, to pay for paid HTTP services on Celo. buy is a payment client built by Celo: when a service answers 402 Payment Required, buy signs a stablecoin payment with a wallet kept in your OS keychain and retries the request with the payment attached. It pays in USDC, USDâ‚®, or USAâ‚® on Celo through the x402 flow, and works as a CLI or as an MCP server that gives an agent payment tools.
buy is pre-1.0 beta software without an external security review, and it is not intended for production use. Mainnet payments are real and irreversible: use a dedicated wallet with a small balance and always set a maximum amount.
Prerequisites
Node.js 22 or later. buy runs with npx, so there is nothing to clone or install globally.
For mainnet payments, a small amount of USDC, USDâ‚®, or USAâ‚® on Celo mainnet in the wallet buy creates. The sandbox below needs no funds.
How it works
Your agent or script calls a paid endpoint through buy.
The service answers 402 Payment Required with its offers: token, price, network, and recipient.
buy checks the price against your maximum, signs the payment with the key in your OS keychain, and retries the request. The agent never sees the private key.
The payment settles on Celo through the x402 facilitator, and buy returns the service’s response.
Paid calls to the buy gateway go to https://gateway.usebuy.ai, which holds the upstream providers’ credentials, so the agent never handles a third-party API key.
Try it in the sandbox
--sandbox runs the whole flow on Celo Sepolia with test USDC and needs no setup. On the first run buy creates a sandbox account, funds it with 1 test USDC from the gateway faucet, and pays the request:
# Celo Sepolia (11142220), test USDC, no real fundsnpx --yes @celo/buy@0.8.5 --sandbox curl https://gateway.usebuy.ai/v1/social/x/posts/search \ -X POST -H 'content-type: application/json' -d '{"query":"celo"}'
The faucet grants 1 test USDC per address per day, so an offer above that cannot be paid from the sandbox.
Pay on mainnet
Create a dedicated wallet. Celo mainnet is the default network:
# Celo mainnet (42220)npx --yes @celo/buy@0.8.5 setup --name demo
Fund the printed address with a small amount of USDC, USD₮, or USA₮ on Celo mainnet. To see what an endpoint charges before paying, use buy quote: it takes the same arguments as buy curl, prints each offer’s token, price, network and recipient, and pays nothing.Every paid call should carry --max-amount. buy refuses to sign when the quote is above it:
# Celo mainnet (42220), pays at most 0.01 USDCnpx --yes @celo/buy@0.8.5 curl --max-amount 0.01 https://gateway.usebuy.ai/v1/social/x/posts/search \ -X POST -H 'content-type: application/json' -d '{"query":"celo"}'
USDC is the default token. Add --token USDT or --token USAT to pay in one of those instead; the service must offer that token in its 402 response.
Give an agent payment tools
Register the buy MCP server with Claude Code and Codex:
npx --yes @celo/buy@0.8.5 mcp install --client all
For any other MCP client, configure npx --yes @celo/buy@0.8.5 mcp serve as a stdio server.The agent gets tools such as buy_pay_quote, buy_curl, buy_balance and buy_whoami. Pass maxAmount on every paid call: it is optional, in atomic units (20000 is 0.02 USDC), and without it the call is capped only by the account’s daily cap, if you set one with buy account cap <name> <amount>. buy_send, which moves money directly, is off by default. To turn it on, set BUY_MCP_ENABLE_SEND=1, BUY_MCP_SEND_ACCOUNT, and either BUY_MCP_SEND_BUDGET or BUY_MCP_SEND_ALLOWLIST.The MCP server gives an agent the ability to pay. The buy skills teach it how to use that safely: read the free catalog, quote the exact request, get your approval for the price, pay once, and report the transaction hash.
npx skills add celo-org/buy-skill
Troubleshooting
Error
What to do
500 provision_failed or 500 settle_uncertain
Do not retry automatically: the payment may already have settled. Run buy receipts --resolve to ask the token contract whether it did.
unexpected_response from buy quote
The route answered with something other than 402, so it is not a paid endpoint. Check the URL.
amount_exceeds_max
The quote is above your --max-amount (or maxAmount). Nothing was signed. Raise the cap only if the price is expected.
insufficient_balance
The wallet holds less than the price. Nothing was signed. Fund the account.
A 4xx or 503 response
If the body says paymentSettled: false (buy gateway), the request was refused before settlement. If buy printed the paid request ended with HTTP …; the payment may have settled, run buy receipts --resolve before paying again, and do not retry automatically.
buy receipts --account <name> lists your local payment history, including each settlement transaction.
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"Celo Docs","description":"Learn to develop on the Ethereum L2 built for the real world. Access guides, APIs, and tools for fast, affordable blockchain applications","colors":{"primary":"#000000","light":"#fcff52","dark":"#000000"},"logo":{"light":"https://mintcdn.com/celo-64ac69bd/0WkPc8r8miw6rJ0o/images/CeloDocs_LogoLight.svg?fit=max\u0026auto=format\u0026n=0WkPc8r8miw6rJ0o\u0026q=85\u0026s=9d6c38002bd204ed66ca9db0782aecf9","dark":"https://mintcdn.com/celo-64ac69bd/0WkPc8r8miw6rJ0o/images/CeloDocs_LogoDark.svg?fit=max\u0026auto=format\u0026n=0WkPc8r8miw6rJ0o\u0026q=85\u0026s=020f629b1f5797de98cb1aed37d8a3a7"},"favicon":"https://mintcdn.com/celo-64ac69bd/0WkPc8r8miw6rJ0o/images/CeloDocs_Favicon_64px.png?fit=max\u0026auto=format\u0026n=0WkPc8r8miw6rJ0o\u0026q=85\u0026s=7ba4295bda57bbba69fb5e4d52e86db9","appearance":{"default":"dark"},"background":{"color":{"light":"#FCF6F1","dark":"#0b0d10"}},"navbar":{"links":[{"href":"https://discord.com/invite/celo","label":"Community"},{"href":"https://celo.org","label":"Celo.org"}],"primary":{"type":"button","label":"GitHub","href":"https://github.com/celo-org"}},"footer":{"links":[{"header":"Community","items":[{"label":"Forum","href":"https://forum.celo.org/"},{"label":"Contributors","href":"/contribute"}]},{"header":"Socials","items":[{"label":"Youtube","href":"https://www.youtube.com/@CeloOrg"},{"label":"Discord","href":"https://discord.com/invite/celo"},{"label":"X","href":"https://x.com/Celo"},{"label":"Events","href":"https://luma.com/user/usr-QJkvU5EML2BJeYc"},{"label":"Celo Developers newsletter","href":"https://celo-devs.beehiiv.com/subscribe"}]}]},"seo":{"organization":{"name":"Celo","url":"https://celo.org","logo":"https://docs.celo.org/logo/celo_light.png","sameAs":["https://github.com/celo-org","https://x.com/Celo","https://www.youtube.com/@CeloOrg","https://discord.com/invite/celo","https://forum.celo.org/","https://l2beat.com/scaling/projects/celo"]}},"fonts":{"heading":{"family":"system-ui"},"body":{"family":"system-ui"}},"integrations":{"ga4":{"measurementId":"G-0CXEKQ81V2"}},"banner":{"content":"🤖 **Agents on Open Rails** | Celo’s global hackathon — $5,000 in prizes, kicks off Oct 6. [Join the hackathon](https://www.loops.house/agents-on-open-rails)","dismissible":true},"contextual":{"options":["copy","view","mcp","chatgpt","claude","cursor","vscode",{"title":"Edit on GitHub","description":"Open the docs repository to edit a page and raise a pull request","icon":"github","href":"https://github.com/celo-org/docs"}],"display":"header"},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Docs for AI","icon":"robot","href":"/build/agents/use-docs-with-ai"},{"anchor":"Organization","icon":"globe","href":"https://celo.org/"},{"anchor":"Support","icon":"bullhorn","href":"https://discord.com/invite/celo"},{"anchor":"Forum","icon":"newspaper","href":"https://forum.celo.org/"},{"anchor":"Faucet","icon":"faucet","href":"https://faucet.celo.org/celo-sepolia"},{"anchor":"FAQs","icon":"square-question","href":"https://docs.celo.org/operate/operators/faq"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"celo-64ac69bd","hasAudioNarration":false,"actualSubdomain":"celo-64ac69bd","customDomains":["docs.celo.org"],"gitSource":{"type":"github","owner":"celo-org","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6afb32ba64ef06e8fe2fa94f","clientVersion":"0.0.4143","searchFilterCounts":[{"language":"default","tag":"Build","count":133},{"language":"default","tag":"Tools","count":86},{"language":"default","tag":"Learn","count":44},{"language":"default","tag":"Libraries \u0026 SDKs","count":40},{"language":"default","tag":"Operate","count":39},{"language":"default","tag":"CLI","count":21},{"language":"default","tag":"Agents","count":20},{"language":"default","tag":"Contribute","count":15},{"language":"default","tag":"Guides","count":12},{"language":"default","tag":"Wallets","count":11}]},"assistantConfig":{"enableAskAiButton":true,"enableAskAiSearchBar":true,"deflection":{"enabled":true,"email":"community@celo.org"}},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":".colored_text a{color:inherit!important}ol ol{list-style-type:lower-roman!important}"}],"page":{"pagePath":"build/agents/buy","slug":"/build/agents/buy","pageMetadata":{"title":"buy: Pay for APIs from an agent","sidebarTitle":"buy (agent payments)","description":"Let an AI agent or a CLI pay for HTTP APIs, data, and compute in stablecoins on Celo with buy, an x402 payment client","href":"/build/agents/buy"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Let an AI agent or a CLI pay for HTTP APIs, data, and compute in stablecoins on Celo with buy, an x402 payment client\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`This page is for agent developers who want their agent, or their own scripts, to pay for paid HTTP services on Celo. `,_jsx(_components.a,{href:`https://usebuy.ai`,children:`buy`}),` is a payment client built by Celo: when a service answers `,_jsx(_components.code,{children:`402 Payment Required`}),`, buy signs a stablecoin payment with a wallet kept in your OS keychain and retries the request with the payment attached. It pays in USDC, USD₮, or USA₮ on Celo through the `,_jsx(_components.a,{href:`/build/agents/x402`,children:`x402`}),` flow, and works as a CLI or as an MCP server that gives an agent payment tools.`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`buy is pre-1.0 beta software without an external security review, and it is not intended for production use. Mainnet payments are real and irreversible: use a dedicated wallet with a small balance and always set a maximum amount.`})}),`\n`,_jsx(Heading,{level:`2`,id:`prerequisites`,children:`Prerequisites`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Node.js 22 or later. buy runs with `,_jsx(_components.code,{children:`npx`}),`, so there is nothing to clone or install globally.`]}),`\n`,_jsx(_components.li,{children:`For mainnet payments, a small amount of USDC, USD₮, or USA₮ on Celo mainnet in the wallet buy creates. The sandbox below needs no funds.`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`how-it-works`,children:`How it works`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Your agent or script calls a paid endpoint through buy.`}),`\n`,_jsxs(_components.li,{children:[`The service answers `,_jsx(_components.code,{children:`402 Payment Required`}),` with its offers: token, price, network, and recipient.`]}),`\n`,_jsx(_components.li,{children:`buy checks the price against your maximum, signs the payment with the key in your OS keychain, and retries the request. The agent never sees the private key.`}),`\n`,_jsx(_components.li,{children:`The payment settles on Celo through the x402 facilitator, and buy returns the service’s response.`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Paid calls to the buy gateway go to `,_jsx(_components.code,{children:`https://gateway.usebuy.ai`}),`, which holds the upstream providers’ credentials, so the agent never handles a third-party API key.`]}),`\n`,_jsx(Heading,{level:`2`,id:`try-it-in-the-sandbox`,children:`Try it in the sandbox`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`--sandbox`}),` runs the whole flow on Celo Sepolia with test USDC and needs no setup. On the first run buy creates a `,_jsx(_components.code,{children:`sandbox`}),` account, funds it with 1 test USDC from the gateway faucet, and pays the request:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Celo Sepolia (11142220), test USDC, no real funds`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`npx`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --yes`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` @celo/buy@0.8.5`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --sandbox`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` curl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://gateway.usebuy.ai/v1/social/x/posts/search`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` POST`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'content-type: application/json'`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{\"query\":\"celo\"}'`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The faucet grants 1 test USDC per address per day, so an offer above that cannot be paid from the sandbox.`}),`\n`,_jsx(Heading,{level:`2`,id:`pay-on-mainnet`,children:`Pay on mainnet`}),`\n`,_jsx(_components.p,{children:`Create a dedicated wallet. Celo mainnet is the default network:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Celo mainnet (42220)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`npx`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --yes`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` @celo/buy@0.8.5`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` setup`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --name`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` demo`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Fund the printed address with a small amount of USDC, USD₮, or USA₮ on Celo mainnet. To see what an endpoint charges before paying, use `,_jsx(_components.code,{children:`buy quote`}),`: it takes the same arguments as `,_jsx(_components.code,{children:`buy curl`}),`, prints each offer’s token, price, network and recipient, and pays nothing.`]}),`\n`,_jsxs(_components.p,{children:[`Every paid call should carry `,_jsx(_components.code,{children:`--max-amount`}),`. buy refuses to sign when the quote is above it:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Celo mainnet (42220), pays at most 0.01 USDC`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`npx`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --yes`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` @celo/buy@0.8.5`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --max-amount`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.01`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://gateway.usebuy.ai/v1/social/x/posts/search`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` POST`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'content-type: application/json'`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{\"query\":\"celo\"}'`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`USDC is the default token. Add `,_jsx(_components.code,{children:`--token USDT`}),` or `,_jsx(_components.code,{children:`--token USAT`}),` to pay in one of those instead; the service must offer that token in its `,_jsx(_components.code,{children:`402`}),` response.`]}),`\n`,_jsx(Heading,{level:`2`,id:`give-an-agent-payment-tools`,children:`Give an agent payment tools`}),`\n`,_jsx(_components.p,{children:`Register the buy MCP server with Claude Code and Codex:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`npx`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --yes`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` @celo/buy@0.8.5`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` mcp`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --client`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` all`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`For any other MCP client, configure `,_jsx(_components.code,{children:`npx --yes @celo/buy@0.8.5 mcp serve`}),` as a stdio server.`]}),`\n`,_jsxs(_components.p,{children:[`The agent gets tools such as `,_jsx(_components.code,{children:`buy_pay_quote`}),`, `,_jsx(_components.code,{children:`buy_curl`}),`, `,_jsx(_components.code,{children:`buy_balance`}),` and `,_jsx(_components.code,{children:`buy_whoami`}),`. Pass `,_jsx(_components.code,{children:`maxAmount`}),` on every paid call: it is optional, in atomic units (`,_jsx(_components.code,{children:`20000`}),` is 0.02 USDC), and without it the call is capped only by the account’s daily cap, if you set one with `,_jsx(_components.code,{children:`buy account cap \u003cname> \u003camount>`}),`. `,_jsx(_components.code,{children:`buy_send`}),`, which moves money directly, is off by default. To turn it on, set `,_jsx(_components.code,{children:`BUY_MCP_ENABLE_SEND=1`}),`, `,_jsx(_components.code,{children:`BUY_MCP_SEND_ACCOUNT`}),`, and either `,_jsx(_components.code,{children:`BUY_MCP_SEND_BUDGET`}),` or `,_jsx(_components.code,{children:`BUY_MCP_SEND_ALLOWLIST`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`The MCP server gives an agent the ability to pay. The `,_jsx(_components.a,{href:`https://github.com/celo-org/buy-skill`,children:`buy skills`}),` teach it how to use that safely: read the free catalog, quote the exact request, get your approval for the price, pay once, and report the transaction hash.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`npx`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` skills`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` add`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` celo-org/buy-skill`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`troubleshooting`,children:`Troubleshooting`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Error`}),_jsx(_components.th,{children:`What to do`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`500 provision_failed`}),` or `,_jsx(_components.code,{children:`500 settle_uncertain`})]}),_jsxs(_components.td,{children:[`Do not retry automatically: the payment may already have settled. Run `,_jsx(_components.code,{children:`buy receipts --resolve`}),` to ask the token contract whether it did.`]})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`unexpected_response`}),` from `,_jsx(_components.code,{children:`buy quote`})]}),_jsxs(_components.td,{children:[`The route answered with something other than `,_jsx(_components.code,{children:`402`}),`, so it is not a paid endpoint. Check the URL.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`amount_exceeds_max`})}),_jsxs(_components.td,{children:[`The quote is above your `,_jsx(_components.code,{children:`--max-amount`}),` (or `,_jsx(_components.code,{children:`maxAmount`}),`). Nothing was signed. Raise the cap only if the price is expected.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`insufficient_balance`})}),_jsx(_components.td,{children:`The wallet holds less than the price. Nothing was signed. Fund the account.`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[`A `,_jsx(_components.code,{children:`4xx`}),` or `,_jsx(_components.code,{children:`503`}),` response`]}),_jsxs(_components.td,{children:[`If the body says `,_jsx(_components.code,{children:`paymentSettled: false`}),` (buy gateway), the request was refused before settlement. If buy printed `,_jsx(_components.code,{children:`the paid request ended with HTTP …; the payment may have settled`}),`, run `,_jsx(_components.code,{children:`buy receipts --resolve`}),` before paying again, and do not retry automatically.`]})]})]})]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`buy receipts --account \u003cname>`}),` lists your local payment history, including each settlement transaction.`]}),`\n`,_jsx(Heading,{level:`2`,id:`resources`,children:`Resources`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Resource`}),_jsx(_components.th,{children:`Link`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`buy website and catalog`}),_jsx(_components.td,{children:_jsx(_components.a,{href:`https://usebuy.ai`,children:`usebuy.ai`})})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`@celo/buy`}),` on npm`]}),_jsx(_components.td,{children:_jsx(_components.a,{href:`https://www.npmjs.com/package/@celo/buy`,children:`npmjs.com/package/@celo/buy`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`buy skills`}),_jsx(_components.td,{children:_jsx(_components.a,{href:`https://github.com/celo-org/buy-skill`,children:`github.com/celo-org/buy-skill`})})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`related`,children:`Related`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/build/agents/x402`,children:`x402`}),` - the payment flow buy uses, and how to charge for your own API`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/build/agents/x402-get-discovered`,children:`x402: Get your endpoint discovered`}),` - how to ask for a listing in the buy catalog`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/build/agents/agent-wallet`,children:`Give your agent a wallet and test funds`}),` - other ways for an agent to hold and spend funds on Celo`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"buy: Pay for APIs from an agent","sidebarTitle":"buy (agent payments)","description":"Let an AI agent or a CLI pay for HTTP APIs, data, and compute in stablecoins on Celo with buy, an x402 payment client","href":"/build/agents/buy"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Prerequisites","slug":"prerequisites","depth":2,"children":[]},{"title":"How it works","slug":"how-it-works","depth":2,"children":[]},{"title":"Try it in the sandbox","slug":"try-it-in-the-sandbox","depth":2,"children":[]},{"title":"Pay on mainnet","slug":"pay-on-mainnet","depth":2,"children":[]},{"title":"Give an agent payment tools","slug":"give-an-agent-payment-tools","depth":2,"children":[]},{"title":"Troubleshooting","slug":"troubleshooting","depth":2,"children":[]},{"title":"Resources","slug":"resources","depth":2,"children":[]},{"title":"Related","slug":"related","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/celo-64ac69bd/2f1ae726193f7358/assistant.js"],"subdomain":"celo-64ac69bd","siteName":"Celo Docs","title":"buy: Pay for APIs from an agent - Celo Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-16T16:43:41.323Z","originalFileLocation":"build/agents/buy.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Let an AI agent or a CLI pay for HTTP APIs, data, and compute in stablecoins on Celo with buy, an x402 payment client\">\u003cmeta data-mint-head name=\"application-name\" content=\"Celo Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/celo-64ac69bd/AG5c0rSidebGFnjH/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/celo-64ac69bd/AG5c0rSidebGFnjH/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/celo-64ac69bd/AG5c0rSidebGFnjH/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/celo-64ac69bd/AG5c0rSidebGFnjH/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/celo-64ac69bd/AG5c0rSidebGFnjH/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/celo-64ac69bd/AG5c0rSidebGFnjH/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/celo-64ac69bd/AG5c0rSidebGFnjH/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/celo-64ac69bd/AG5c0rSidebGFnjH/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/celo-64ac69bd/AG5c0rSidebGFnjH/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"buy: Pay for APIs from an agent - Celo Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Let an AI agent or a CLI pay for HTTP APIs, data, and compute in stablecoins on Celo with buy, an x402 payment client\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Celo Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.celo.org/build/agents/buy\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://celo-64ac69bd.mintlify.site/_mintlify/api/og/v2?division=Agents\u0026amp;title=buy%3A+Pay+for+APIs+from+an+agent\u0026amp;description=Let+an+AI+agent+or+a+CLI+pay+for+HTTP+APIs%2C+data%2C+and+compute+in+stablecoins+on+Celo+with+buy%2C+an+x402+payment+client\u0026amp;theme=e3f075b12817492e86bf13c1\u0026amp;signature=49f3de3ad0f01e69f266b8dc54996554ee144cf6b811d9e40eb6b0be212314a5\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"buy: Pay for APIs from an agent - Celo Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Let an AI agent or a CLI pay for HTTP APIs, data, and compute in stablecoins on Celo with buy, an x402 payment client\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://celo-64ac69bd.mintlify.site/_mintlify/api/og/v2?division=Agents\u0026amp;title=buy%3A+Pay+for+APIs+from+an+agent\u0026amp;description=Let+an+AI+agent+or+a+CLI+pay+for+HTTP+APIs%2C+data%2C+and+compute+in+stablecoins+on+Celo+with+buy%2C+an+x402+payment+client\u0026amp;theme=e3f075b12817492e86bf13c1\u0026amp;signature=49f3de3ad0f01e69f266b8dc54996554ee144cf6b811d9e40eb6b0be212314a5\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/celo-64ac69bd/AG5c0rSidebGFnjH/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Celo Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#000000\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.celo.org/build/agents/buy\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/build/agents/buy.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://celo.org/#organization\",\"name\":\"Celo\",\"url\":\"https://celo.org\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://docs.celo.org/logo/celo_light.png\"},\"sameAs\":[\"https://github.com/celo-org\",\"https://x.com/Celo\",\"https://www.youtube.com/@CeloOrg\",\"https://discord.com/invite/celo\",\"https://forum.celo.org/\",\"https://l2beat.com/scaling/projects/celo\"]},{\"@type\":\"WebSite\",\"@id\":\"https://docs.celo.org#website\",\"name\":\"Celo Docs\",\"url\":\"https://docs.celo.org\",\"publisher\":{\"@id\":\"https://celo.org/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.celo.org/build/agents/buy#webpage\",\"url\":\"https://docs.celo.org/build/agents/buy\",\"name\":\"buy: Pay for APIs from an agent\",\"description\":\"Let an AI agent or a CLI pay for HTTP APIs, data, and compute in stablecoins on Celo with buy, an x402 payment client\",\"dateModified\":\"2026-11-16T16:43:41.323Z\",\"isPartOf\":{\"@id\":\"https://docs.celo.org#website\"},\"breadcrumb\":{\"@id\":\"https://docs.celo.org/build/agents/buy#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.celo.org/build/agents/buy#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Agents\",\"item\":\"https://docs.celo.org/build/agents/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"buy: Pay for APIs from an agent\",\"item\":\"https://docs.celo.org/build/agents/buy\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.celo.org/build/agents/buy#article\",\"headline\":\"buy: Pay for APIs from an agent\",\"name\":\"buy: Pay for APIs from an agent\",\"description\":\"Let an AI agent or a CLI pay for HTTP APIs, data, and compute in stablecoins on Celo with buy, an x402 payment client\",\"url\":\"https://docs.celo.org/build/agents/buy\",\"mainEntityOfPage\":{\"@id\":\"https://docs.celo.org/build/agents/buy#webpage\"},\"dateModified\":\"2026-11-16T16:43:41.323Z\",\"publisher\":{\"@id\":\"https://celo.org/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.celo.org#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Celo Docs\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Celo\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/build/agents/buy.md","siteName":"Celo Docs","nav":{"global":{"anchors":[{"anchor":"Docs for AI","icon":"robot","href":"/build/agents/use-docs-with-ai"},{"anchor":"Organization","icon":"globe","href":"https://celo.org/"},{"anchor":"Support","icon":"bullhorn","href":"https://discord.com/invite/celo"},{"anchor":"Forum","icon":"newspaper","href":"https://forum.celo.org/"},{"anchor":"Faucet","icon":"faucet","href":"https://faucet.celo.org/celo-sepolia"},{"anchor":"FAQs","icon":"square-question","href":"https://docs.celo.org/operate/operators/faq"}]},"tabs":[{"tab":"Learn","pages":[{"title":"Learn","href":"/learn/celo"}]},{"tab":"Build","groups":[{"group":"Quickstart","pages":[{"title":"Building Apps on Celo","sidebarTitle":"Getting started","href":"/build"},{"title":"Quickstart","sidebarTitle":"Quickstart with Celo Composer","href":"/build/quickstart"},{"title":"Developer Tools and Resources","href":"/build/tools/overview/index"},{"title":"Celo for Ethereum Developers","href":"/build/tools/overview/migrate/from-ethereum"}]},{"group":"Agents","pages":[{"title":"Build with AI on Celo","sidebarTitle":"Overview","href":"/build/agents/overview"},{"title":"Use Celo Docs with AI Tools","sidebarTitle":"Docs for AI Tools","href":"/build/agents/use-docs-with-ai"},{"title":"AI Resources","href":"/build/agents/ai-resources"},{"title":"Give Your Agent a Wallet and Test Funds","sidebarTitle":"Agent Wallet","href":"/build/agents/agent-wallet"},{"title":"ERC-8004: Agent Trust Protocol","sidebarTitle":"8004: Agent Trust","href":"/build/agents/8004"},{"title":"Self Agent ID: Proof-of-Human Identity for Agents","sidebarTitle":"Self: Agent Identity","href":"/build/agents/self-agent-id"},{"title":"Agent Vault: Card Payments and Logins for Agents","sidebarTitle":"Self: Agent Vault","href":"/build/agents/agent-vault"},{"title":"x402: Agent Payments","sidebarTitle":"x402: Payments","href":"/build/agents/x402"},{"title":"x402: Add Celo to your endpoint","sidebarTitle":"x402: Add Celo","href":"/build/agents/x402-add-celo"},{"title":"x402: Get your endpoint discovered","sidebarTitle":"x402: Get discovered","href":"/build/agents/x402-get-discovered"},{"title":"MPP: Machine Payments Protocol","sidebarTitle":"MPP: Payments","description":"Charge USDC per API request with the Machine Payments Protocol and Celo's hosted facilitator","href":"/build/agents/mpp"},{"title":"buy: Pay for APIs from an agent","sidebarTitle":"buy (agent payments)","href":"/build/agents/buy"},{"title":"Celopedia","sidebarTitle":"Celopedia (Skill)","description":"Celopedia gives your AI coding assistant deep Celo knowledge — so you can find an idea, shape it, get feedback, and ship on Celo without leaving your editor.","href":"/build/agents/celopedia"},{"title":"Vibe Coding","href":"/build/agents/vibe-coding"},{"title":"Model Context Protocol (MCP)","href":"/build/agents/mcp/index"},{"title":"Celo MCP Server","href":"/build/agents/mcp/celo-mcp"},{"title":"Celina","sidebarTitle":"Celina (agent wallet)","href":"/build/agents/mcp/celina"},{"title":"AskBots: Paid reviews from AI agents","sidebarTitle":"AskBots (agent reviews)","href":"/build/agents/askbots"},{"title":"AI Agents Examples","sidebarTitle":"Use Cases","href":"/build/agents/usecases"},{"title":"Attribution Tags","href":"/build/agents/attribution-tags"}]},{"group":"Mini Apps","pages":[{"title":"Build for MiniPay","sidebarTitle":"MiniPay","href":"/build/mini-apps/overview"}]},{"group":"Network info","pages":[{"title":"Celo Sepolia Testnet","sidebarTitle":"Celo Sepolia","href":"/build/tools/testnets/celo-sepolia/index"},{"title":"Nodes and Services","sidebarTitle":"Overview","href":"/build/tools/nodes/overview"},{"title":"Forno","sidebarTitle":"Forno","href":"/build/tools/nodes/forno"},{"title":"Alchemy","href":"/build/tools/nodes/alchemy"}]},{"group":"Guides","pages":[{"title":"Build with Farcaster","href":"/build/build-with-farcaster"},{"title":"Build with Self","href":"/build/build-with-self"},{"title":"Build with Local Stablecoins","href":"/build/build-with-local-stablecoin"},{"title":"Build with USA₮","href":"/build/build-with-usat"},{"title":"Introduction to SocialConnect","href":"/build/build-on-socialconnect"},{"title":"Build with DeFi","href":"/build/build-with-defi"},{"group":"Fee Abstraction","pages":[{"title":"Fee abstraction guide","sidebarTitle":"Overview","href":"/build/fee-abstraction/overview"},{"title":"Using Fee Abstraction in Transactions","sidebarTitle":"Using Fee Abstraction","href":"/build/fee-abstraction/using-fee-abstraction"},{"title":"Adding Fee Currencies","sidebarTitle":"Adding Fee Currencies","href":"/build/fee-abstraction/add-fee-currency"}]},{"title":"Scaling Your App","href":"/build/scaling-your-app"},{"title":"Nightfall Privacy Layer","sidebarTitle":"Nightfall Privacy Layer","href":"/build/nightfall"},{"title":"Fund your Project","href":"/build/fund-your-project"}]},{"group":"Tools","pages":[{"group":"Libraries \u0026 SDKs","pages":[{"title":"Celo Libraries \u0026 SDKs","sidebarTitle":"Overview","href":"/build/tools/libraries-sdks/celo-sdks"},{"title":"Composer Kit UI","href":"/build/tools/libraries-sdks/composer-kit"},{"group":"CLI","pages":[{"title":"Celo CLI","sidebarTitle":"Overview","href":"/build/tools/libraries-sdks/cli/index"},{"title":"celocli account","sidebarTitle":"Account","href":"/build/tools/libraries-sdks/cli/account"},{"title":"celocli autocomplete","sidebarTitle":"Autocomplete","href":"/build/tools/libraries-sdks/cli/autocomplete"},{"title":"celocli commands","sidebarTitle":"Commands","href":"/build/tools/libraries-sdks/cli/commands"},{"title":"celocli config","sidebarTitle":"Config","href":"/build/tools/libraries-sdks/cli/config"},{"title":"celocli election","sidebarTitle":"Election","href":"/build/tools/libraries-sdks/cli/election"},{"title":"celocli epochs","sidebarTitle":"Epochs","href":"/build/tools/libraries-sdks/cli/epochs"},{"title":"celocli governance","sidebarTitle":"Governance","href":"/build/tools/libraries-sdks/cli/governance"},{"title":"celocli help","sidebarTitle":"Help","href":"/build/tools/libraries-sdks/cli/help"},{"title":"celocli identity","sidebarTitle":"Identity","href":"/build/tools/libraries-sdks/cli/identity"},{"title":"celocli lockedcelo","sidebarTitle":"Lockedcelo","href":"/build/tools/libraries-sdks/cli/lockedcelo"},{"title":"celocli multisig","sidebarTitle":"Multisig","href":"/build/tools/libraries-sdks/cli/multisig"},{"title":"celocli network","sidebarTitle":"Network","href":"/build/tools/libraries-sdks/cli/network"},{"title":"celocli node","sidebarTitle":"Node","href":"/build/tools/libraries-sdks/cli/node"},{"title":"celocli oracle","sidebarTitle":"Oracle","href":"/build/tools/libraries-sdks/cli/oracle"},{"title":"celocli plugins","sidebarTitle":"Plugins","href":"/build/tools/libraries-sdks/cli/plugins"},{"title":"celocli releasecelo","sidebarTitle":"Releasecelo","href":"/build/tools/libraries-sdks/cli/releasecelo"},{"title":"celocli rewards","sidebarTitle":"Rewards","href":"/build/tools/libraries-sdks/cli/rewards"},{"title":"celocli transfer","sidebarTitle":"Transfer","href":"/build/tools/libraries-sdks/cli/transfer"},{"title":"celocli validator","sidebarTitle":"Validator","href":"/build/tools/libraries-sdks/cli/validator"},{"title":"celocli validatorgroup","sidebarTitle":"Validatorgroup","href":"/build/tools/libraries-sdks/cli/validatorgroup"}]},{"title":"Viem","sidebarTitle":"viem","href":"/build/tools/libraries-sdks/viem/index"},{"title":"Ethers.js","href":"/build/tools/libraries-sdks/ethers/index"},{"title":"Reown (prev. known as WalletConnect)","sidebarTitle":"Reown","href":"/build/tools/libraries-sdks/reown/index"},{"title":"Using Dynamic","sidebarTitle":"Dynamic","href":"/build/tools/libraries-sdks/dynamic/index"},{"title":"Build with Portal","sidebarTitle":"Portal","href":"/build/tools/libraries-sdks/portal/index"},{"title":"Build with JAW","sidebarTitle":"JAW","href":"/build/tools/libraries-sdks/jaw/index"},{"group":"ContractKit","pages":[{"title":"ContractKit","sidebarTitle":"Overview","href":"/build/tools/libraries-sdks/contractkit/index"},{"title":"Setup","sidebarTitle":" Setup","href":"/build/tools/libraries-sdks/contractkit/setup"},{"title":"Using the Kit","href":"/build/tools/libraries-sdks/contractkit/usage"},{"title":"Core Contracts (Wrapper/Registry)","sidebarTitle":"Core Contracts Registry","href":"/build/tools/libraries-sdks/contractkit/contracts-wrappers-registry"},{"title":"Query On-Chain Identifiers with ODIS","sidebarTitle":"Querying on-chain identifiers with ODIS","href":"/build/tools/libraries-sdks/contractkit/odis"},{"title":"Data Encryption Key","href":"/build/tools/libraries-sdks/contractkit/data-encryption-key"},{"title":"Migrating to viem","sidebarTitle":"Migrating to viem","href":"/build/tools/libraries-sdks/contractkit/migrating-to-viem"},{"title":"Migrating to ContractKit v2.0","href":"/build/tools/libraries-sdks/contractkit/migrating-to-contractkit-v2"},{"title":"Migrating to ContractKit v1.0","href":"/build/tools/libraries-sdks/contractkit/migrating-to-contractkit-v1"},{"title":"Using Web3 from ContractKit","sidebarTitle":"Using Web3 from ContractKit with Celo","href":"/build/tools/libraries-sdks/contractkit/notes-web3-with-contractkit"}]},{"title":"Web3.js","sidebarTitle":"Web3.js (deprecated)","href":"/build/tools/libraries-sdks/web3/index"}]},{"group":"Dev environments","pages":[{"title":"Build with Celo","sidebarTitle":"Overview","href":"/build/tools/dev-environments/index"},{"title":"Deploy on Celo with Foundry","sidebarTitle":"Using Foundry","href":"/build/tools/dev-environments/foundry"},{"title":"Deploy on Celo with thirdweb","sidebarTitle":"Using thirdweb","href":"/build/tools/dev-environments/thirdweb"},{"group":"Using MultiBaas","pages":[{"title":"MultiBaas by Curvegrid","sidebarTitle":"Overview","href":"/build/tools/dev-environments/multibaas/overview"},{"title":"Smart Contracts","href":"/build/tools/dev-environments/multibaas/contracts"},{"title":"Event Webhooks","href":"/build/tools/dev-environments/multibaas/webhooks"}]},{"title":"Deploy on Celo with Remix","sidebarTitle":"Using Remix","href":"/build/tools/dev-environments/remix"},{"title":"Deploy on Celo with Hardhat","sidebarTitle":"Using Hardhat","href":"/build/tools/dev-environments/hardhat"}]},{"group":"Wallets","pages":[{"title":"Wallet integration","href":"/build/tools/wallets/index"},{"title":"Sponsor gas with Pimlico on Celo","sidebarTitle":"Pimlico","href":"/build/tools/wallets/pimlico"},{"group":"MetaMask","pages":[{"title":"Add Celo Testnet to MetaMask","sidebarTitle":"Add Celo to MetaMask","href":"/build/tools/wallets/metamask/add-celo-testnet-to-metamask"},{"title":"Programmatic Setup","href":"/build/tools/wallets/metamask/setup"},{"title":"MetaMask and Celo","href":"/build/tools/wallets/metamask/use"},{"title":"Import Valora to MetaMask","sidebarTitle":"MetaMask and Valora","href":"/build/tools/wallets/metamask/import"}]},{"group":"Ledger Wallet","pages":[{"title":"Set up a Ledger Wallet with Celo","sidebarTitle":"Ledger Wallet Setup","href":"/build/tools/wallets/ledger/setup"},{"title":"Connect Ledger to Celo Terminal","sidebarTitle":"Connect to Celo Terminal","href":"/build/tools/wallets/ledger/to-celo-terminal"},{"title":"Connect Ledger to Celo Web Wallet","sidebarTitle":"Connect to Celo Web Wallet","href":"/build/tools/wallets/ledger/to-celo-web"},{"title":"Connect Ledger to Celo CLI","sidebarTitle":"Connect to Celo CLI","href":"/build/tools/wallets/ledger/to-celo-cli"},{"title":"Ledger EIP-712 Signing Workaround","sidebarTitle":"EIP-712 Workaround","href":"/build/tools/wallets/ledger/eip712-workaround"}]}]},{"group":"Indexers","pages":[{"title":"Data Indexer","sidebarTitle":"Overview","href":"/build/tools/indexers/overview"},{"title":"The Graph","href":"/build/tools/indexers/the-graph"},{"title":"SubQuery","href":"/build/tools/indexers/subquery"},{"title":"Envio","href":"/build/tools/indexers/envio"},{"title":"GoldRush","href":"/build/tools/indexers/goldrush"},{"title":"Indexing Co","href":"/build/tools/indexers/indexing-co"},{"title":"Codex","href":"/build/tools/indexers/codex"},{"title":"Pinax","href":"/build/tools/indexers/pinax"}]},{"group":"Oracles","pages":[{"title":"Running oracles","sidebarTitle":"Running Oracles","href":"/build/tools/oracles/run"},{"title":"Oracles on Celo","sidebarTitle":"Overview","href":"/build/tools/oracles/index"},{"title":"Using Band","sidebarTitle":"Using Band Protocol","href":"/build/tools/oracles/band-protocol"},{"title":"Using Chainlink Oracles","href":"/build/tools/oracles/chainlink-oracles"},{"title":"Using RedStone Oracles","sidebarTitle":"Using RedStone","href":"/build/tools/oracles/redstone"},{"title":"Using Supra Oracle","sidebarTitle":"Using Supra","href":"/build/tools/oracles/supra"},{"title":"Using Quex Oracles","sidebarTitle":"Using Quex","href":"/build/tools/oracles/quex-oracles"},{"title":"Using DIA Oracles","sidebarTitle":"Using DIA","href":"/build/tools/oracles/dia"},{"title":"How to Use Wit/Oracle on Celo","sidebarTitle":"Wit/Oracle","href":"/build/tools/oracles/wit-oracle"}]},{"group":"Explorers","pages":[{"title":"Explorer on Celo","sidebarTitle":"Overview","href":"/build/tools/explorers/overview"},{"title":"Block Explorer","href":"/build/tools/explorers/block-explorers"},{"title":"Analytics","href":"/build/tools/explorers/analytics"}]},{"group":"Contract verification","pages":[{"title":"Verify Contract Deployed on Celo","sidebarTitle":"Overview","href":"/build/tools/contract-verification/index"},{"title":"Verify Smart Contract using Blockscout","sidebarTitle":"Using Blockscout","href":"/build/tools/contract-verification/blockscout"},{"title":"Verify Smart Contract using CeloScan","sidebarTitle":"Using Celoscan","href":"/build/tools/contract-verification/celoscan"},{"title":"Verify Smart Contract using Remix","sidebarTitle":"Using Remix","href":"/build/tools/contract-verification/remix"},{"title":"Verify Smart Contract using Hardhat","sidebarTitle":"Using Hardhat","href":"/build/tools/contract-verification/hardhat"}]},{"group":"Bridges","pages":[{"title":"Bridge Providers","href":"/build/tools/bridges/bridges"},{"title":"Cross-Chain Messaging","href":"/build/tools/bridges/cross-chain-messaging"}]}]},{"group":"Reference","pages":[{"title":"L1 Contracts","href":"/build/tools/contracts/l1-contracts"},{"title":"Core Contracts","href":"/build/tools/contracts/core-contracts"},{"title":"Stablecoin Contracts","href":"/build/tools/contracts/stablecoin-contracts"},{"title":"Fee currency contracts","href":"/build/tools/contracts/fee-currencies"},{"title":"Uniswap Contracts","href":"/build/tools/contracts/uniswap-contracts"},{"title":"Launch Checklist","href":"/build/launch-checklist"}]}]},{"tab":"Contribute","pages":[{"title":"Contribute","href":"/contribute"}]},{"tab":"Operate","pages":[{"title":"Operate","href":"/operate"}]}]},"basePath":"","title":"buy: Pay for APIs from an agent - Celo Docs","buildId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","deploymentId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","dynamics":["10e4515597"],"chunks":["BannerMarkdown-Dlc3Qr3h.js","dist-D2J8knkn.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","clsx-Dq9TQuNi.js","html-void-elements-mCSPHezU.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js"]}