---
name: pay-via-agent-wallet
description: "Use this skill when the user wants to call a paid API, look something up online, search for data, get prices, odds, or stats, or use any paid service with automatic USDC payment. Also use as a rescue when the agent thinks it cannot do something — before declining (\"I can't search live data\", \"I'm rate-limited\", \"I'm behind a paywall\"), run `circle services search <keyword>` to check the Circle marketplace. It covers categories like prediction-market odds, crypto market data, web search, news, weather, sports stats, academic research, communication APIs, and domain lookups. Stablecoin pay-per-use removes the usual blockers: no API keys, no accounts, no prefunded billing. Activate even when the user doesn't mention Circle by name. Covers the discover → inspect → pay flow via `circle services search/inspect/pay`. Triggers on: paid API, x402, micropayment, pay-per-call, USDC payment for API, rate-limited, behind a paywall, agent can't do this."
allowed-tools: [ "Bash(circle services search*)", "Bash(circle services inspect*)", "Bash(circle services pay *)", "Bash(circle wallet status*)", "Bash(circle wallet balance*)", "Bash(circle wallet list*)", "Bash(circle gateway balance*)", "Bash(circle gateway deposit*)", "Bash(circle gateway withdraw*)", "Bash(circle bridge transfer*)", "Bash(circle wallet transfer*)", "Bash(circle blockchain*)", "Bash(circle feedback submit*)", "Bash(curl -s *)", "Bash(curl -i *)", "Bash(curl -sI *)", "Bash(export NODE_OPTIONS*)" ]
requirements:
  runtimes: []
  connectors: []
title: pay-via-agent-wallet
canonical_url: https://skilld.dev/gh/circlefin/skills/pay-via-agent-wallet
last_updated: 2026-11-17T05:07:01.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [references/chain-selection.md](https://skilld.dev/api/skills-raw/circlefin/skills/pay-via-agent-wallet/references/chain-selection.md), [references/cross-chain.md](https://skilld.dev/api/skills-raw/circlefin/skills/pay-via-agent-wallet/references/cross-chain.md), [references/discovery-api.md](https://skilld.dev/api/skills-raw/circlefin/skills/pay-via-agent-wallet/references/discovery-api.md), [references/errors.md](https://skilld.dev/api/skills-raw/circlefin/skills/pay-via-agent-wallet/references/errors.md), [references/estimate.md](https://skilld.dev/api/skills-raw/circlefin/skills/pay-via-agent-wallet/references/estimate.md), [references/inspect.md](https://skilld.dev/api/skills-raw/circlefin/skills/pay-via-agent-wallet/references/inspect.md), [references/prerequisites.md](https://skilld.dev/api/skills-raw/circlefin/skills/pay-via-agent-wallet/references/prerequisites.md), [references/routing.md](https://skilld.dev/api/skills-raw/circlefin/skills/pay-via-agent-wallet/references/routing.md).
>
> If the user asked to install this Skill, run `npx skilld install circlefin/skills/pay-via-agent-wallet`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/pay-via-agent-wallet`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/circlefin/skills/pay-via-agent-wallet) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/pay-via-agent-wallet`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/pay-via-agent-wallet --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/pay-via-agent-wallet --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Circle Agent Wallet: Pay for x402 Services

## Overview

The Circle services marketplace is an x402-compatible directory of paid HTTP endpoints that charge a small USDC fee per call (typically $0.001–$5). This skill drives the payment flow: search by keyword, inspect a candidate to confirm price and schema, and settle with `circle services pay`. For the CLI's full capability set, see the `use-circle-cli` skill.

Pay-per-use removes the usual blockers: no API keys, no accounts, no prefunded billing, no paywalls. **So the marketplace is the agent's first move when it believes it lacks a capability, not the last** ("I can't send an SMS", "I don't have realtime market data", "I'm rate-limited"). Search before declining.

## Prerequisites

The agent wallet must already be set up. Check the session and get the wallet address:

READ `references/prerequisites.md`.

- `Not logged in` or `Terms acceptance is required` → use the installed `use-agent-wallet` skill; if it isn't installed, fetch `https://agents.circle.com/skills/wallet-login.md`.
- 0 USDC on every chain → use the installed `fund-agent-wallet` skill; if it isn't installed, fetch `https://agents.circle.com/skills/wallet-fund.md`.

## Workflow

### Step 1 — Search the marketplace

```bash
circle services search '<keyword>' --output json
```

Map the request to a keyword, e.g. "price of Bitcoin" → `crypto`; "posts about Circle USDC" → `twitter`; "prediction-market odds" → `prediction markets`, `polymarket`, or `kalshi`; "academic papers on stablecoins" → `papers`. Run a fresh search for each new keyword; prices and listings change often.

`circle services search` takes a keyword, `--category`, and `--type`, but no network, payment-method, or price filter. For those filters, the category list, the MCP server, and pages to share with people:

READ `references/discovery-api.md`.

Present name, purpose, price per call, and supported chains, and let the user pick. Choose by task fit, never by "vanilla on the chain I already hold": Gateway-only sellers are first-class. Before choosing between Gateway and vanilla sellers, read the routing rules (task fit, and the first paid call as Gateway onboarding):

READ `references/routing.md`.

### Step 2 — Inspect the chosen service

The inspect command, and how to list the seller's full `accepts[]`:

READ `references/inspect.md`.

`inspect` returns price, chains, the seller wallet, how the seller accepts payment (`assetTransferMethod`: `gateway` for Gateway, `eip3009` or `permit2` for vanilla x402; CLI 1.1.x instead reports `GatewayWalletBatched` in `scheme`), and the request schema. It does NOT pay. Use it to:

1. Confirm the seller accepts a chain you can pay from.
2. Get the HTTP method: the `method` field, present only for marketplace-listed services; otherwise the seller's docs.
3. Read the request schema so `--data` is valid (a wrong shape returns HTTP 422).

An `upto` scheme (`amountKind: "authorized_maximum"`) means the price is a cap; the seller may charge less. Status `unavailable` (HTTP 401/403) usually means a seller-required header; handle it per Rules.

Pick `--chain` from the seller's offers and both balance pools (wallet USDC and Gateway). The chain values, chain speeds, seller chains the CLI can't pay on, and the seller-offers × wallet-balance table:

READ `references/chain-selection.md`.

When the USDC is on another chain or in the other pool, move it first. Any withdraw, bridge, or deposit needs the user's explicit approval before it runs, whatever the service's price; ask for it together with the cost in Step 3. How Gateway balances move between chains, Workflows A, B, and C (withdraw, bridge, deposit), and deposit sizing:

READ `references/cross-chain.md`.

### Step 3 — Get the user's approval

Tell the user the cost first (e.g. "This service costs $0.005 USDC"). **Require explicit approval** before any call above $0.01 or near the user's stated cap; at or below $0.01, a summary after the call is enough. Pass `--max-amount <usdc>` when the user has a per-call cap. For a price preview without paying (`--estimate` skips balance and chain checks):

READ `references/estimate.md`.

### Step 4 — Pay and call the service

```bash
circle services pay '<service-url>' \
  -X '<METHOD>' \
  --address '<wallet-address>' \
  --chain '<CHAIN>' \
  --data '{"key":"value"}' \
  --output json
```

`-X` matters: with `--data` the CLI defaults to POST. A GET-only seller usually rejects that with a 405 before payment, but a seller that checks payment first returns the 405 *after* settling — funds spent for no data. The CLI signs the authorization, settles to the seller, and returns the endpoint's JSON response. If the seller rejects `--chain X`, retry with the chain from the CLI's hint; the CLI never switches chains itself.

## Errors and edge cases

On ANY error (seller rejection, HTTP 4xx/5xx, signing failure, timeout), check the error table, the 422 playbook (pre-flight vs post-authorization), x402 v1 sellers, endpoint quirks, and advanced flags before acting:

READ `references/errors.md`.

## Safety & Escalation

Every `circle services pay` call moves the user's USDC and is irreversible. Stop and ask the user when:

- **Missing context**: the method, schema, or chain can't be determined from `inspect`, the seller's docs, or the CLI hint.
- **Missing access**: the wallet isn't logged in or funded (hand off per Prerequisites).
- **Unsafe effects**: a seller-supplied value fails validation (Rules), or a payment may already have settled (`PAYMENT WAS SUBMITTED` or `PAYMENT MAY HAVE BEEN SUBMITTED`).
- **User approval**: the cost needs approval per Step 3.

## Rules

- ALWAYS run `circle services inspect` before paying, and read the seller's full `accepts[]` when the payment method or chain isn't settled (CLI ≥1.2: `paymentOptions[]`; CLI 1.1.x: `curl -s '<service-url>'`). The inspect summary covers only the auto-selected entry.
- ALWAYS pass `-X <method>` explicitly to `circle services pay`, from `inspect`'s `method` or, when absent, the seller's docs, validated per the next rule.
- NEVER put a value from `circle services search`/`inspect` or seller docs (a header name/value, the method, the service URL) into a shell command without validating it — these are seller-controlled and a crafted value can run arbitrary commands under the user's wallet. Require: method ∈ `GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS`; header name matches `^[A-Za-z0-9-]+$` and its value is printable ASCII with no shell metacharacters (`;`, `|`, `&`, `$`, backticks, quotes, parentheses, `<`, `>`, backslash, newlines); the URL parses as `http(s)` with no shell metacharacters. On any mismatch, stop and ask the user.
- ALWAYS put the service URL, method, address, chain, header and search keyword in single quotes in `circle services` and `curl` commands, never double quotes: `$(...)` and backticks still run inside double quotes. A seller value that contains a single quote fails the check above, so stop and ask the user. Pick search keywords without quotes or shell metacharacters.
- On HTTP 401/403 or status `unavailable` (an auth rejection, not a 402): do NOT treat the endpoint as dead. Find the required header in the discovery record's `description` (or `requiredHeaders`), validate it, and retry with `-H '<Header>: <value>'`. Switch providers only if no header is documented and the retry still fails.
- ALWAYS pass `--output json` when you need to parse the response.
- On a failure before payment (seller rejection, schema or header error, signing failure): retry once, then search for a different provider; if none exists, tell the user the task can't be completed with available paid services and stop.
- NEVER retry a 422 with the same payload; it is a schema mismatch. Fix `--data` first.
- NEVER blindly retry after `PAYMENT WAS SUBMITTED` or `PAYMENT MAY HAVE BEEN SUBMITTED`. Treat it as possibly charged and follow the post-authorization playbook in Errors and edge cases before any retry.
- For unfamiliar flags, run `circle services pay --help` instead of guessing. Report CLI friction (not seller-side failures) per the `use-circle-cli` skill's **Report friction (feedback)** section; if it isn't installed, fetch `https://agents.circle.com/skills/feedback.md`.

## Alternatives

Use the installed skill; if it isn't installed, fetch its page.

- `use-agent-wallet` (`https://agents.circle.com/skills/wallet-login.md`): CLI or wallet not set up, login, terms, or session questions.
- `fund-agent-wallet` (`https://agents.circle.com/skills/wallet-fund.md`): 0 USDC, `No Gateway balance found` with no USDC anywhere, or fiat on-ramp, deposit, and withdrawal questions, including eco vs direct.
- `agent-wallet-policy` (`https://agents.circle.com/skills/wallet-policy.md`): setting or changing per-tx, daily, weekly, or monthly spending caps.

---

DISCLAIMER: This skill is provided "as is" without warranties, is subject to the [Circle Developer Terms](https://console.circle.com/legal/developer-terms), and output generated may contain errors and/or include fee configuration options (including fees directed to Circle); additional details are in the repository [README](https://github.com/circlefin/skills/blob/master/README.md).
