<!-- tempo-docs-context -->
> Source: [/docs/guide/machine-payments/agent](https://tempo.xyz/developers/docs/guide/machine-payments/agent.md)
> Section: [Machine Payments](https://tempo.xyz/developers/docs/agents.md). Pay for APIs, accept API payments, find services, and use Machine Payments Protocol (MPP).
> [Documentation index](https://tempo.xyz/developers/llms.txt) · [Docs skill](https://tempo.xyz/developers/SKILL.md)

> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.xyz/developers/llms.txt) and Markdown pages directly.

<span id="agent-quickstart-build-an-ai-agent-that-pays-for-apis" />

# Pay with the CLI

Use `tempo request` to call a paid API from a terminal, script, or agent. The CLI handles the MPP challenge and payment retry.

<span id="install-the-tempo-cli" />

<span id="log-in-to-tempo-wallet" />

First [install the CLI and connect Tempo Wallet](https://tempo.xyz/developers/docs/cli/wallet#download-the-tempo-wallet-cli). Confirm the wallet's network and balance with `tempo wallet whoami`; paid requests use real funds unless the service and wallet are explicitly configured for testnet.

:::steps
<span id="discover-mpp-services" />

### Find a service

Search by task, then inspect a service's endpoint, HTTP method, and request schema:

```bash
tempo wallet services --search image
tempo wallet services <SERVICE_ID>
```

<span id="preview-the-mpp-request-cost" />

### Preview the request cost

The following example uses an image-generation endpoint. Check the service details for current models, schemas, and availability before running it.

```bash
tempo request --dry-run -X POST \
  --json '{"prompt":"a sunset over the ocean"}' \
  https://fal.mpp.tempo.xyz/fal-ai/flux/dev
```

`--dry-run` requests the payment terms without paying.

<span id="make-an-mpp-paid-request" />

### Pay for the request

After reviewing the price, run the request:

```bash
tempo request -X POST \
  --json '{"prompt":"a sunset over the ocean"}' \
  https://fal.mpp.tempo.xyz/fal-ai/flux/dev
```

Use [`--max-spend`](https://tempo.xyz/developers/docs/cli/request#tempo-request-flags) to cap payment spending for the command. Check the service response for the result or job ID.
:::

## Set up an AI agent

Follow [Let an agent pay for services](https://tempo.xyz/developers/docs/wallet/recipes#let-an-agent-pay-for-services) for skills and spending controls. If you are integrating your own agent account, start with [Give an agent access](https://tempo.xyz/developers/docs/accounts/agents).

<span id="next-steps-for-agentic-payments" />

## Continue with paid requests

* [Find services](https://tempo.xyz/developers/docs/guide/machine-payments/discover-services) covers the catalog API and read-only discovery MCP server.
* [Tempo Wallet CLI](https://tempo.xyz/developers/docs/cli/wallet) covers funding, access keys, and payment sessions.
* [`tempo request`](https://tempo.xyz/developers/docs/cli/request) lists request flags.
* [Accept payments for an API](https://tempo.xyz/developers/docs/guide/machine-payments/server) covers the service side.
