# Authenticated requests Source: https://agentcash.dev/docs/authentication Use SIWX (Sign-In With X) for endpoints that require wallet identity. Some endpoints require wallet-based authentication, either on its own or alongside payment. This uses the **SIWX** (Sign-In With X) protocol, where your wallet signs a challenge to prove its identity. ## How SIWX works The endpoint responds with `402 Payment Required` and includes a SIWX challenge, either on its own or alongside a payment requirement. Your wallet signs the server's challenge to prove ownership of the address. AgentCash retries the original request with the signed proof in the headers. ## Making authenticated requests Ask your agent to use `fetch`: > Use AgentCash fetch to call [https://example.com/api/protected-endpoint](https://example.com/api/protected-endpoint). Or via CLI: ```bash theme={null} npx agentcash fetch https://example.com/api/protected-endpoint ``` AgentCash handles the full SIWX handshake automatically and only falls back to payment if the route still returns `402`. ## When to use authenticated vs paid requests | Scenario | Tool / command | | -------------------------------------- | --------------------------------------- | | Endpoint requires USDC payment | `fetch` | | Endpoint requires wallet identity only | `fetch` | | Not sure which auth the endpoint uses | `check_endpoint_schema` / `check` first | Use `check_endpoint_schema` (MCP) or `npx agentcash check` (CLI) to inspect an endpoint before calling it. The response tells you whether it requires payment, SIWX auth, or both, but `fetch` handles every case. # Calling paid APIs Source: https://agentcash.dev/docs/calling-apis How to use AgentCash to call premium, paywalled endpoints. The primary use case for AgentCash is calling APIs that require payment. Endpoints may charge via x402 (on-chain USDC transfer) or MPP (signed off-chain payment intent); AgentCash handles both transparently. This guide covers the flow from your agent's perspective. ## Basic usage Ask your agent to fetch data from a premium endpoint: > Use AgentCash to fetch [https://stableenrich.dev/api/company/lookup](https://stableenrich.dev/api/company/lookup) with body `{"domain": "anthropic.com"}`. The agent calls the `fetch` tool (in MCP mode) or uses the CLI, which: 1. Sends the request to the endpoint 2. Receives a `402 Payment Required` response listing accepted protocols (`x402`, `mpp`) and networks 3. Picks a protocol your wallet supports and signs the payment proof 4. Retries the request with the proof attached 5. Returns the response data and payment info ## Checking the price first If you want to know the cost before paying, ask your agent to check the endpoint: > Check the pricing for [https://stableenrich.dev/api/company/lookup](https://stableenrich.dev/api/company/lookup) using AgentCash. This probes the endpoint without making a payment. It returns the price, accepted methods, and input/output schema. ## Request options The `fetch` command accepts standard HTTP options: ``` URL: https://example.com/api/endpoint Method: POST (default: GET) Headers: {"Content-Type": "application/json"} Body: {"key": "value"} Timeout: 30000 (milliseconds) ``` AgentCash sets `Content-Type: application/json` by default for requests with a body. ## Payment info in responses Every paid request returns payment metadata alongside the response data: * **amount**: USDC paid * **transaction**: on-chain transaction hash * **network**: which chain the payment was made on ## Error handling If a payment fails, AgentCash returns a clear error. Common issues: | Error | Cause | Fix | | --------------------------- | ------------------------------------- | ----------------------------------- | | Insufficient balance | Not enough USDC for the request price | [Fund your wallet](/docs/wallet/funding) | | Payment verification failed | On-chain verification issue | Retry the request | | Timeout | Endpoint took too long to respond | Increase timeout or try again | # Catalog resource pipeline Source: https://agentcash.dev/docs/catalog-resource-pipeline # Catalog Resource Pipeline This document describes the resource-level search pipeline after the outcome state simplification. ## Core Model Searchability is not liveness. A resource is search eligible when both are true: * it has derived metadata: `indexed = true` * it has an active embedding for the configured resource embedding model The main pipeline does not decide whether a resource is live. Runtime health is a separate monitor signal and can be used as a post-filter or operator warning, but it is not a prerequisite for enrichment, embedding, or search eligibility. ## Base Flow ```mermaid theme={null} flowchart TD scanner["x402scan / mppscan"] --> discover["discover origin + resources"] discover --> row["indexed_resources row"] row --> due["next_pipeline_run_at due"] due --> lease["resource_pipeline_active_resources lease"] lease --> schema["schema lookup"] schema --> schemaDecision{"schema or source metadata available?"} schemaDecision -- "no, no prior searchable metadata" --> dead["terminal: dead"] schemaDecision -- "no, prior searchable metadata exists" --> failedSchema["terminal: failed"] schemaDecision -- "yes" --> enrich["derive metadata"] enrich --> enrichDecision{"indexed metadata produced?"} enrichDecision -- "no" --> failedEnrich["terminal: failed"] enrichDecision -- "yes" --> embed["write active embedding"] embed --> embedDecision{"active embedding exists?"} embedDecision -- "no" --> failedEmbed["terminal: failed"] embedDecision -- "yes" --> success["terminal: success"] success --> search["search eligible"] ``` The stage historically named `probe` is now a schema loading step. Its only job is to load endpoint schema information from available specs and, when needed, from the payment challenge. It does not perform raw liveness checks and does not write live/error/timeout health state. ## Terminal Outcomes The durable terminal outcome is stored on `catalog.indexed_resources`: * `pipeline_outcome` * `pipeline_outcome_reason` * `pipeline_outcome_at` * `pipeline_failure_kind` | Outcome | Meaning | How it happens | Retry behavior | Search impact | | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | | `success` | The resource has metadata and, when embeddings are configured, an active embedding. | Schema/source metadata was available, enrichment produced indexed metadata, and embedding exists. | No automatic success refresh is scheduled by liveness. Future scanner/material changes can mark it due again. | Search eligible when origin/search filters also pass. | | `failed` | The latest attempt could not finish, but the resource is recoverable or may recover. | Source metadata is unavailable but prior searchable metadata is preserved, enrichment failed, embedding failed, worker crashed, dispatch failed, or another transient/system issue occurred. | Backoff retry: 1h, 4h, 12h, 1d, 3d, then 7d. Manual retry can force it sooner. | Existing metadata/embedding may still make it search eligible. Failed outcome alone does not hide it. | | `dead` | The pipeline has no information it can use to derive searchable metadata, and this is treated as non-recoverable until rediscovery changes the resource. | No schema/source metadata is available and there is no prior searchable metadata to preserve, or discovery removes the resource. | Not scheduled for retry. A material rediscovery can reset it to `unknown` and make it due again. | Not search eligible unless rediscovered and successfully enriched later. | | `unknown` | Legacy or newly discovered resource that has not finalized under the new outcome model. | New rows and material resets start here. Migration preserves unknown where no stronger outcome can be inferred. | Eligible when it has missing schema/metadata/embedding work and is due. | Search eligibility still depends only on metadata plus embedding. | ## Lifecycle Fields The pipeline state shown in admin is separate from terminal outcome: | Queue state | Meaning | | ----------- | ---------------------------------------------------------------- | | `queued` | A dispatcher selected the resource and created an active lease. | | `running` | A worker owns the lease and is executing schema/enrich/embed. | | `ready` | No lease exists, work is needed, and the retry time is due. | | `waiting` | Work is needed, but retry backoff has not elapsed. | | `failed` | Latest terminal outcome is `failed` and retry is due. | | `healthy` | No current pipeline work is needed and the resource is not dead. | Work is needed when any of these are true: * both input and output schemas are missing and the resource has not already succeeded with other source metadata * latest outcome is `failed` * enrichment hash is stale * enriched spec hash differs from the current spec hash * embedding text hash is missing * active embedding is missing Stale health probes are not a pipeline work trigger. ## Schema Lookup Versus Health These are intentionally different concepts: | Concern | Purpose | Pipeline role | | -------------- | ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | | Schema lookup | Find endpoint/spec information that can improve metadata and embedding text. | Used when available, but scanner/discovery source metadata can also drive enrichment. | | Health monitor | Measure runtime availability, latency, and recent failures. | Advisory/post-filter only. Does not block enrichment, embedding, or search eligibility. | This means a resource can have a failed health check and still be enriched, embedded, and search eligible if schema/source metadata exists. ## Live Search Meaning Live semantic search joins active resource embeddings and requires `indexed = true`. It also requires normal search filters such as non-removed resource, non-dismissed origin, protocol match, score threshold, and usage filtering unless broad search is requested. It does not require: * `probe_status = 'live'` * `last_live_at` * consecutive probe failure grace Autocomplete remains metadata based and requires `indexed = true`, non-removed resource, and non-dismissed origin. It does not require an active embedding. ## Admin UI Reading The Resources admin page separates three axes: * Search: metadata plus active embedding. * Pipeline: latest indexing outcome and queue state. * Health: runtime availability signal, separate from search and pipeline eligibility. Use outcome filters to inspect terminal results: * `success`: metadata and active embedding exist. * `failed`: latest attempt failed and can retry. * `dead`: no source information for embedding; not scheduled. * `unknown`: not finalized under the new model yet. Use health filters only to inspect runtime monitor behavior. # agentcash fetch, check, discover, search Source: https://agentcash.dev/docs/cli/fetch Make authenticated and paid HTTP requests, check schemas, discover endpoints, and search for providers from the command line. ## fetch ```bash theme={null} npx agentcash fetch [options] ``` Sends an HTTP request with automatic SIWX authentication and payment handling. If the endpoint returns `402`, AgentCash attempts SIWX first and only pays if the route still requires it. Equivalent to the MCP [`fetch`](/docs/tools/fetch) tool. Run `check ` first to confirm the request body schema. Skipping this often causes 400 errors from wrong field names. ### Options | Flag | Description | | ------------------------------- | ------------------------------------------------------ | | `-m` / `--method ` | HTTP method (default: GET) | | `-b` / `--body ` | Raw request body string, passed through as-is | | `-H` / `--header ` | HTTP header in `Name: value` format (repeatable) | | `--timeout ` | Request timeout in milliseconds | | `--payment-protocol ` | Force a specific payment protocol: `x402` or `mpp` | | `--payment-network ` | Preferred network for SIWX and payment when applicable | | `--max-amount ` | Abort if the payment challenge exceeds this amount | ### Example ```bash theme={null} npx agentcash fetch https://stableenrich.dev/api/apollo/people-enrich \ -m POST \ -b '{"email":"user@example.com"}' ``` ## fetch-auth ```bash theme={null} npx agentcash fetch-auth [options] ``` Deprecated alias for `fetch`. It uses the same unified flow and accepts the same options, but new integrations should call [`fetch`](/docs/tools/fetch) directly. ## check ```bash theme={null} npx agentcash check [options] ``` Gets the input/output schema and auth mode (paid or SIWX) for an endpoint. Returns exact field names from the OpenAPI spec. Equivalent to the MCP [`check_endpoint_schema`](/docs/tools/check-endpoint-schema) tool. Call this before `fetch` to avoid 400 errors from wrong field names. ### Options | Flag | Description | | ------------------------------ | ------------------------------------------------------------------------------------- | | `-H` / `--header ` | HTTP header in `Name: value` format (repeatable) | | `-b` / `--body ` | Probe the endpoint live for an exact price quote (useful when pricing is range-based) | ### Example ```bash theme={null} npx agentcash check https://stableenrich.dev/api/apollo/people-enrich ``` ## discover ```bash theme={null} npx agentcash discover [options] ``` Lists available endpoints at an API origin with descriptions and auth modes (paid or SIWX). Works with any origin, not just registered ones. Equivalent to the MCP [`discover_api_endpoints`](/docs/tools/discover-api-endpoints) tool. ### Options | Flag | Description | | -------------------- | ------------------------------------------------------------------------------------------------------ | | `--include-guidance` | Return full provider documentation (useful when composing multiple endpoints or when usage is unclear) | ### Example ```bash theme={null} npx agentcash discover https://stableenrich.dev ``` ## search ```bash theme={null} npx agentcash search "" ``` Finds paid API services by natural-language query. Returns matching origins with endpoints and pricing. Use this to find an API before you know which origin to call. Equivalent to the MCP [`search`](/docs/tools/search) tool. ### Example ```bash theme={null} npx agentcash search "send a physical postcard" ``` ## try ```bash theme={null} npx agentcash try ``` Fetches a new origin's resources and returns a prompt guiding you through calling the first endpoint. Good for exploring an unfamiliar origin. ## register ```bash theme={null} npx agentcash register ``` Registers an origin with AgentCash by discovering and indexing its endpoints. ### Example ```bash theme={null} npx agentcash register https://stableenrich.dev ``` # agentcash install Source: https://agentcash.dev/docs/cli/install Install MCP mode for your AI client. ```bash theme={null} npx agentcash install [--client ] ``` The `install` command sets up AgentCash as an MCP server for your AI client. Without `--client`, it runs an interactive prompt to detect and select your client. ## Options Skip the interactive prompt and install for a specific client. Valid values: `claude-code`, `cursor`, `claude`, `codex`, `cline`, `windsurf`, `warp`, `gemini-cli`, `goose`, `zed`, `opencode`, `openclaw` ## Examples Interactive install: ```bash theme={null} npx agentcash install ``` Direct install for Cursor: ```bash theme={null} npx agentcash install --client cursor ``` ## What it does 1. Detects which AI clients are available on your system 2. Prompts you to select one (or uses `--client`) 3. Writes the MCP configuration to the client's config file 4. Confirms the installation was successful # CLI overview Source: https://agentcash.dev/docs/cli/overview Use AgentCash from the command line. The `agentcash` CLI is the primary interface for AgentCash. Use it to discover premium APIs, make paid requests, manage your wallet, add skills, and install [MCP mode](/docs/mcp-mode) for AI clients. ## Install ```bash theme={null} npm i -g agentcash ``` Or run commands directly with `npx`: ```bash theme={null} npx agentcash [options] ``` ## Commands | Command | Description | | ------------------ | -------------------------------------------------------------------------------------------------- | | `onboard [code]` | Set up wallet, configure MCP, and optionally redeem an invite code | | `search ` | Find paid API services by natural-language query | | `discover ` | List available endpoints on an origin with descriptions and auth modes | | `check ` | Get input/output schema and auth mode for an endpoint. Run this before `fetch` to avoid 400 errors | | `fetch ` | HTTP fetch with automatic SIWX auth and payment | | `fetch-auth ` | Deprecated alias for `fetch` | | `try ` | Fetch a new origin's resources and return a prompt for calling the first endpoint | | `register ` | Register an origin with AgentCash (discover + index endpoints) | | `add ` | Add a skill to the AgentCash MCP server | | `balance` | Show total wallet balance | | `accounts` | Show per-network balances, addresses, and deposit links | | `redeem ` | Redeem an invite code | | `fund` | Open the funding page in your browser | | `install` | Install MCP mode for your AI client | | `server` | Start the MCP server (default when no command given) | | `report-error` | Report a critical bug (emergency only) | ## Global options | Flag | Description | | ------------------- | ----------------------------------------------------------------------- | | `--verbose` / `-v` | Enable debug output to stderr | | `--quiet` / `-q` | Suppress stderr output | | `--format ` | Output format: `json` (default for pipes) or `pretty` (default for TTY) | | `--invite ` | Invite code to redeem for starter credits | | `-y` / `--yes` | Yes to all prompts | | `--dev` | Use development endpoints (localhost) | | `--sessionId ` | Session ID for request tracing (auto-generated if not provided) | | `--provider ` | Custom provider identifier | | `--version` | Show version number | # Wallet Commands Source: https://agentcash.dev/docs/cli/wallet Check balances, inspect accounts, fund, and redeem credits from the command line. ## balance ```bash theme={null} npx agentcash balance ``` Shows your total USDC balance across supported networks. Creates a wallet automatically if one doesn't exist. ## accounts ```bash theme={null} npx agentcash accounts ``` Lists each supported network with its balance, wallet address, and deposit link. Use this when you need funding instructions or network-specific wallet details. ## redeem ```bash theme={null} npx agentcash redeem ``` Redeems an invite code for USDC on Base. Codes are one-time use. The invite code to redeem. ## fund ```bash theme={null} npx agentcash fund ``` Opens the AgentCash funding page for your wallet in your browser. ## Output format Add `--format json` to any wallet-related command for machine-readable output: ```bash theme={null} npx agentcash balance --format json ``` # Discovering endpoints Source: https://agentcash.dev/docs/discovering-endpoints Find available premium APIs and their pricing. AgentCash can discover what endpoints are available on any compatible origin, along with their pricing and schemas. ## Search for a capability When you don't know which origin to use, start with `search`. It takes a natural-language query and returns ranked providers along with endpoint details and pricing. > Use AgentCash to search for an API that can send physical mail. Or from the CLI: ```bash theme={null} npx agentcash search "send physical mail" ``` Skip `search` when the task clearly maps to a registered origin. For example, people research maps to `stableenrich.dev` and image generation maps to `stablestudio.dev`. In that case, go straight to `discover` below. ## Discover endpoints on an origin Ask your agent: > Discover available endpoints on stableenrich.dev using AgentCash. Or use the CLI: ```bash theme={null} npx agentcash discover https://stableenrich.dev ``` This fetches the discovery document from the origin and returns a list of endpoints with their descriptions and pricing. ## Known origins AgentCash ships with a set of pre-indexed origins: | Origin | Description | | ------------------ | ---------------------------------------------------------------- | | `stableenrich.dev` | Company and contact enrichment via Apollo, Exa, Serper, and more | | `stablesocial.dev` | Social media data (Instagram, TikTok, YouTube, Reddit, Facebook) | | `stablestudio.dev` | Image and video generation | | `stableupload.dev` | File hosting | | `stableemail.dev` | Email sending | These are available immediately without needing to discover them first. ## Check a specific endpoint To inspect a single endpoint's pricing and schema without paying: > Check the schema for POST [https://stableenrich.dev/api/company/lookup](https://stableenrich.dev/api/company/lookup) using AgentCash. Or via CLI: ```bash theme={null} npx agentcash check https://stableenrich.dev/api/company/lookup ``` This returns: * **Price**: how much the call costs in USDC * **Methods**: which HTTP methods are supported * **Input schema**: expected request body format * **Output schema**: response format * **Auth type**: whether it uses x402, SIWX, or other auth ## Discovery protocol Servers advertise their endpoints as an OpenAPI document at `/openapi.json`. Each paid operation carries an `x-payment-info` block with price, currency, and accepted protocols (`x402`, `mpp`). AgentCash parses this to build the endpoint index. If `/openapi.json` is missing, AgentCash falls back to `/.well-known/x402` for older servers. Either path makes the server discoverable. See [server discovery](/docs/discovery) if you're building a server and want to be listed. # Become discoverable Source: https://agentcash.dev/docs/discovery Build once, register reliably, and keep your resources discoverable by agents. ## Why This Matters If agents can't discover your API, they can't call it. Bulletproof discovery turns your endpoint from merely listed to reliably invocable. When metadata and runtime `402` behavior agree, agents succeed on the first pass. You get fewer AgentCash failures, less debugging churn, and more real agent traffic. * Publish OpenAPI as the canonical machine-readable contract. * Treat runtime `402` challenge behavior as the final source of truth. ## Copy for Agents Paste this directly into your coding agent. It should handle discovery implementation and validation end-to-end. ## Discovery Strategy OpenAPI is the canonical discovery format. Use it for the cleanest machine-readable contract and best agent compatibility. The `x-payment-info` fields are a superset of the [IETF API payment spec](https://paymentauth.org/draft-payment-discovery-00.txt). The fields do not collide, so your service is still compatible if you already follow the IETF standard. Expected location: `GET /openapi.json` Requirements: * Top-level fields: `openapi`, `info.title`, `info.x-guidance`, `info.version`, `paths`. * For paid operations: `responses.402` and `x-payment-info`. * Set `x-payment-info.protocols` (array of protocol objects) and one pricing mode (`fixed` or `dynamic`) with `currency`. * Use OpenAPI security + `components.securitySchemes` for auth declaration. * Add high-level guidance in `info.x-guidance` for user-friendly discovery. ### Minimal valid example ```json theme={null} { "openapi": "3.1.0", "info": { "title": "My API", "version": "1.0.0", "description": "example demo server", "x-guidance": "Use POST /api/search for neural web search. Accepts a JSON body with a 'query' field." }, "x-discovery": { "ownershipProofs": [""] }, "paths": { "/api/search": { "post": { "operationId": "search", "summary": "Search - Neural search across the web", "tags": ["Search"], "x-payment-info": { "price": { "mode": "fixed", "currency": "USD", "amount": "0.010000" }, "protocols": [{ "x402": {} }, { "mpp": { "method": "", "intent": "", "currency": "" } }] }, "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "query": { "type": "string", "minLength": 1, "description": "The query string for the search" } }, "required": ["query"] } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "type": "object", "properties": { "results": { "type": "array", "items": { "type": "object" } } }, "required": ["results"] } } } }, "402": { "description": "Payment Required" } } } } } } ``` ## Discovery Precedence AgentCash uses the OpenAPI document at `/openapi.json` to discover your API. It will also check the runtime 402 challenge behavior to ensure it is correct. | Order | Source | Expected Location | | ----- | ---------------- | ----------------------------- | | 1 | OpenAPI document | `/openapi.json` | | 2 | 402 API Response | `Correct 402 header response` | ## Common Failure Reasons These are the most frequent errors seen during registration. | Error | Likely Cause | Fix | | ----------------------------- | -------------------------------------------- | ------------------------------------------------------ | | `Not Found` | OpenAPI not found at `{origin}/openapi.json` | Add an OpenAPI document at `{origin}/openapi.json` | | `Input/Output Schema Missing` | Operation has no input or output schema | Add an input and output schema to the operation | | `No Payment Modes Detected` | No payment modes detected in the response | Add a valid payment mode to the response (x402 or MPP) | # How it works Source: https://agentcash.dev/docs/how-it-works How AgentCash discovers premium APIs. ## The discovery layer AgentCash connects your agent to a growing ecosystem of premium API providers. When your agent needs data or services, it uses AgentCash to: 1. **Discover** what services are available from API providers 2. **Inspect** pricing and schemas before committing 3. **Call** the API with automatic payment 4. **Return** the data to your agent in a clean format Providers publish their APIs as an OpenAPI document at `/openapi.json`, with `x-payment-info` annotations on each paid operation. AgentCash also falls back to `/.well-known/x402` for older servers. See [server discovery](/docs/discovery) for the spec. ## The payment flow AgentCash supports two open payment standards: [x402](https://www.x402.org) and [MPP](https://mpp.dev). Both fit into the following payment flow: Your agent calls a service like any normal HTTP request. The provider responds with `402 Payment Required`, including the price and accepted payment methods. AgentCash signs a payment with your local wallet and retries the request with proof of payment. The provider verifies the payment and returns the requested data. This happens within a single call. Your agent sees a clean response with the data it asked for. x402 was developed by Coinbase and is managed by the Linux Foundation. MPP was developed by Stripe and Tempo Labs. Both are open standards, and AgentCash picks the right one automatically based on what the provider accepts. ## What AgentCash handles Whether you use the CLI, the agent skill, or MCP mode, AgentCash manages: * **API discovery**: finds available APIs and their pricing via `/openapi.json` (or `/.well-known/x402` as a fallback) * **Payment detection**: recognizes 402 responses and extracts payment requirements * **Credential signing**: signs USDC payment proofs with your local wallet key * **Automatic retry**: retries the original request with the signed payment attached * **Balance checking**: verifies you have sufficient funds before paying ## Get started Give your AI agent access to 3,200+ premium APIs. Sell your services to agents. # Claude Code Source: https://agentcash.dev/docs/installation/claude-code Install AgentCash MCP mode in Claude Code. Run this command in your terminal: ```bash theme={null} claude mcp add agentcash --scope user -- npx -y agentcash@latest ``` The `--scope user` flag makes AgentCash available in all your Claude Code sessions, not just the current project. ## Verify installation Start a Claude Code session and ask: > What is my AgentCash balance? Claude should call the `get_balance` tool and return your total balance. If you need deposit links or network-specific wallet addresses, it should call `list_accounts`. ## Project-scoped installation To install AgentCash for a specific project only, omit the `--scope` flag: ```bash theme={null} claude mcp add agentcash -- npx -y agentcash@latest ``` This writes to `.claude/settings.local.json` in your project directory. ## Options You can pass flags to AgentCash after the `--` separator: ```bash theme={null} claude mcp add agentcash --scope user -- npx -y agentcash@latest --verbose ``` | Flag | Description | | ------------------ | ------------------------------------- | | `--verbose` / `-v` | Enable debug output on stderr | | `--quiet` / `-q` | Suppress all stderr output | | `--dev` | Use development endpoints (localhost) | # Claude Cowork Source: https://agentcash.dev/docs/installation/claude-cowork Install AgentCash in Claude Cowork using the MCPB bundle. Follow the [guided install](https://agentcash.dev/install/claude) to download and set up the MCPB bundle, or install manually: Download [agentcash.mcpb](https://agentcash.dev/agentcash.mcpb). Open the `agentcash.mcpb` file. Claude will prompt you to install the MCP server. After installing, paste this into a new conversation to confirm it's working: ``` Check that the agentcash MCP is installed by calling get_balance. If I have an invite code, I'll share it so you can redeem it with redeem_invite. ``` # Claude Desktop Source: https://agentcash.dev/docs/installation/claude-desktop Install AgentCash MCP mode in Claude Desktop. Follow the [guided install](https://agentcash.dev/install/claude) for the fastest setup, or configure manually below. Edit `~/Library/Application Support/Claude/claude_desktop_config.json`: ```json theme={null} { "mcpServers": { "agentcash": { "command": "npx", "args": ["-y", "agentcash@latest"] } } } ``` Edit `%APPDATA%\Claude\claude_desktop_config.json`: ```json theme={null} { "mcpServers": { "agentcash": { "command": "npx", "args": ["-y", "agentcash@latest"] } } } ``` Restart Claude Desktop after saving the file. ## Verify installation Start a new conversation and ask: > What is my AgentCash balance? Claude should call the `get_balance` tool and return your total balance. If you need deposit links or network-specific wallet addresses, it should call `list_accounts`. # Cursor Source: https://agentcash.dev/docs/installation/cursor Install AgentCash MCP mode in Cursor. ## Guided install Run the installer and select Cursor: ```bash theme={null} npx agentcash install ``` This creates the MCP configuration at `.cursor/mcp.json` in your project. ## Manual install Add the following to `.cursor/mcp.json` in your project root: ```json theme={null} { "mcpServers": { "agentcash": { "command": "npx", "args": ["-y", "agentcash@latest"] } } } ``` ## Verify installation Open Cursor and ask the agent: > What is my AgentCash balance? The agent should call the `get_balance` tool and return your total balance. If you need deposit links or network-specific wallet addresses, it should call `list_accounts`. # Other clients Source: https://agentcash.dev/docs/installation/other-clients Install AgentCash MCP mode in Codex, Windsurf, Warp, and more. AgentCash supports any client that implements the [Model Context Protocol](https://modelcontextprotocol.io). ## Guided install The installer auto-detects available clients: ```bash theme={null} npx agentcash install ``` ## Supported clients Add to your Codex MCP configuration: ```json theme={null} { "mcpServers": { "agentcash": { "command": "npx", "args": ["-y", "agentcash@latest"] } } } ``` Add to your Windsurf MCP configuration (`.windsurf/mcp.json`): ```json theme={null} { "mcpServers": { "agentcash": { "command": "npx", "args": ["-y", "agentcash@latest"] } } } ``` Add to your Warp MCP configuration: ```json theme={null} { "mcpServers": { "agentcash": { "command": "npx", "args": ["-y", "agentcash@latest"] } } } ``` Add to your Gemini CLI MCP configuration: ```json theme={null} { "mcpServers": { "agentcash": { "command": "npx", "args": ["-y", "agentcash@latest"] } } } ``` Add to your Goose MCP configuration: ```json theme={null} { "mcpServers": { "agentcash": { "command": "npx", "args": ["-y", "agentcash@latest"] } } } ``` Add to your Zed settings: ```json theme={null} { "context_servers": { "agentcash": { "command": { "path": "npx", "args": ["-y", "agentcash@latest"] } } } } ``` Add to your Cline MCP settings (`.cline/mcp_settings.json`): ```json theme={null} { "mcpServers": { "agentcash": { "command": "npx", "args": ["-y", "agentcash@latest"] } } } ``` ## Generic setup For any MCP-compatible client, the configuration follows the same pattern: * **Command**: `npx` * **Arguments**: `["-y", "agentcash@latest"]` * **Transport**: stdio (default) Refer to your client's documentation for where to place MCP server configuration. # MCP mode Source: https://agentcash.dev/docs/mcp-mode Run AgentCash as an MCP server inside any compatible AI client. AgentCash can run as a [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server, giving your AI client direct tool access to all AgentCash capabilities: paid API calls, endpoint discovery, wallet management, and authenticated requests. MCP mode is one of three ways to use AgentCash, alongside the [CLI](/docs/cli/overview) and the [agent skill](/docs/quickstart-agents#2-give-your-agent-the-skill). ## When to use MCP mode MCP mode is ideal when your AI client supports MCP and you want: * **Tool-based access**: the agent calls AgentCash tools directly * **Structured responses**: tool responses come back as structured data the agent can parse * **Automatic integration**: the tools are available in the agent's context with no extra setup ## Quick install The guided installer detects your client: ```bash theme={null} npx agentcash install ``` Or install for a specific client: ```bash theme={null} claude mcp add agentcash --scope user -- npx -y agentcash@latest ``` ```bash theme={null} npx agentcash install --client cursor ``` Or add manually to `.cursor/mcp.json`: ```json theme={null} { "mcpServers": { "agentcash": { "command": "npx", "args": ["-y", "agentcash@latest"] } } } ``` Follow the [guided install](https://agentcash.dev/install/claude) to download and install the MCPB bundle. Follow the [guided install](https://agentcash.dev/install/claude), or add manually to your config file (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS): ```json theme={null} { "mcpServers": { "agentcash": { "command": "npx", "args": ["-y", "agentcash@latest"] } } } ``` Restart Claude Desktop after saving. See [full client list](/docs/installation/other-clients) for Codex, Windsurf, Warp, and more. ## Available tools When running in MCP mode, AgentCash exposes these tools to your agent: | Tool | What it does | | --------------------------------------------------------- | -------------------------------------------------- | | [`fetch`](/docs/tools/fetch) | HTTP request with automatic SIWX auth and payment | | [`fetch_with_auth`](/docs/tools/fetch-with-auth) | Deprecated alias for `fetch` | | [`get_balance`](/docs/tools/get-balance) | Total wallet balance across supported networks | | [`list_accounts`](/docs/tools/list-accounts) | Per-network balances, addresses, and deposit links | | [`search`](/docs/tools/search) | Find API providers by natural-language query | | [`check_endpoint_schema`](/docs/tools/check-endpoint-schema) | Probe pricing and schema without paying | | [`discover_api_endpoints`](/docs/tools/discover-api-endpoints) | Find all endpoints on an origin | | [`redeem_invite`](/docs/tools/redeem-invite) | Redeem an invite code for free USDC | ## Verify installation Start a session with your AI client and ask: > What is my AgentCash balance? The agent should call the `get_balance` tool and return your total balance. If you later need deposit links or network-specific addresses, the agent should call `list_accounts`. ## Server options You can pass flags to the MCP server process: | Flag | Description | | ------------------ | ------------------------------------- | | `--verbose` / `-v` | Enable debug output on stderr | | `--quiet` / `-q` | Suppress all stderr output | | `--dev` | Use development endpoints (localhost) | # For agents Source: https://agentcash.dev/docs/openclaw-setup/for-agents Step-by-step guide for AI agents to provision, install, and configure OpenClaw on a DigitalOcean droplet. # OpenClaw on DigitalOcean — Agent Playbook Step-by-step guide for AI agents to provision, install, and configure OpenClaw on a DigitalOcean droplet. Every step is CLI-executable. Human intervention is called out explicitly where unavoidable. **Docs index:** [https://docs.openclaw.ai/llms.txt](https://docs.openclaw.ai/llms.txt) *** The goal is to provision OpenClaw with as little human involvement as possible. ## Requirements You, the agent, should install or create the below things on behalf of the user. Do not wait to implement the plan by requiring the user to create these things. You should go ahead and start checking if they are installed/created, and if not, create/install them on the users behalf. **ONLY** ask the user questions when you need their input, like pasting in a key from their browser. You can even open the browser for them. * A DigitalOcean account with a **Personal Access Token** (API key) (check if they have it with `doctl account get 2>&1`) * An LLM provider API key (Anthropic, OpenAI, etc.) or OAuth credentials * SSH key pair on the local machine (we use key-based auth, not passwords) * `doctl` installed on the local machine (the DO CLI) * A telegram account (or WhatsApp, Discord, Signal, etc.). Our prompt works best with Telegram. Download it [here](https://telegram.org/apps). ### If the user doesn't have an SSH key ```bash theme={null} ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N "" ``` ### If the user doesn't have a DigitalOcean account or API token Open the signup page for them: ```bash theme={null} open "https://cloud.digitalocean.com/registrations/new" # Linux: xdg-open "https://cloud.digitalocean.com/registrations/new" ``` After signup, direct them to create an API token: ```bash theme={null} open "https://cloud.digitalocean.com/account/api/tokens/new" # Linux: xdg-open "https://cloud.digitalocean.com/account/api/tokens/new" ``` They need to create a token with **read + write** scope. ### Install doctl (if not present) ```bash theme={null} # macOS brew install doctl # Linux (snap) snap install doctl # Linux (manual) curl -sL https://github.com/digitalocean/doctl/releases/latest/download/doctl-$(curl -s https://api.github.com/repos/digitalocean/doctl/releases/latest | grep tag_name | cut -d'"' -f4 | tr -d v)-linux-amd64.tar.gz | tar xz -C /usr/local/bin ``` ### Authenticate doctl ```bash theme={null} doctl auth init --access-token "$DIGITALOCEAN_API_TOKEN" ``` *** ## Step 1: Upload SSH Key and Create the Droplet ### Ensure your SSH key is on DigitalOcean ```bash theme={null} # Check if any keys exist on the account doctl compute ssh-key list # If none, import your local public key doctl compute ssh-key import openclaw-key --public-key-file ~/.ssh/id_ed25519.pub ``` ### Create the droplet ```bash theme={null} doctl compute droplet create openclaw1 \ --region nyc1 \ --size s-1vcpu-2gb \ --image ubuntu-24-04-x64 \ --ssh-keys "$(doctl compute ssh-key list --format ID --no-header | head -1)" \ --wait \ --format ID,Name,PublicIPv4 \ --no-header ``` **Notes:** * `--size s-1vcpu-2gb` is the \*\*$12/mo** plan (1 CPU, 2GB RAM, 50GB SSD, 2TB transfer). Recommended — avoids OOM issues during setup and normal operation. Use `s-1vcpu-1gb` ($6/mo) only if cost is a hard constraint (requires swap and `NODE_OPTIONS` tuning). * `--region`: change to nearest region. List available: `doctl compute region list` * `--ssh-keys`: uses the first SSH key on the account. An SSH key must be uploaded before creating the droplet (see above). ### Get the droplet IP ```bash theme={null} DROPLET_IP=$(doctl compute droplet get openclaw1 --format PublicIPv4 --no-header) echo "$DROPLET_IP" ``` ### Wait for SSH to become available ```bash theme={null} until ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=accept-new root@"$DROPLET_IP" 'echo ready' 2>/dev/null; do sleep 5 done ``` *** ## Step 2: Add Swap (recommended; required for 1GB droplets) ```bash theme={null} ssh root@"$DROPLET_IP" 'bash -s' <<'SWAP' fallocate -l 2G /swapfile chmod 600 /swapfile mkswap /swapfile swapon /swapfile echo "/swapfile none swap sw 0 0" >> /etc/fstab echo "Swap enabled: $(swapon --show)" SWAP ``` *** ## Step 3: Install Node.js ```bash theme={null} ssh root@"$DROPLET_IP" 'bash -s' <<'NODE' # Install nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash source ~/.bashrc # Install Node.js LTS nvm install --lts # Verify node --version && npm --version NODE ``` ## Step 4: Install OpenClaw ```bash theme={null} ssh root@"$DROPLET_IP" 'bash -s' <<'INSTALL' source ~/.bashrc # Install OpenClaw (skip interactive setup — we onboard in the next step) curl -fsSL https://openclaw.ai/install.sh | OPENCLAW_SKIP_SETUP=1 bash || true # Verify — the installer may exit non-zero even on success because # OPENCLAW_SKIP_SETUP causes the setup wizard to abort after the binary # is already installed. The version check is the real success signal. openclaw --version INSTALL ``` **`OPENCLAW_SKIP_SETUP=1`** prevents the installer from launching the interactive setup wizard. The script will likely exit with a non-zero code — this is expected. As long as `openclaw --version` prints a version, the install succeeded. **Note on hooks:** There is no `--skip-hooks` flag on the `onboard` command. Hooks are not part of the onboarding wizard — they are configured separately after setup via `openclaw hooks`. *** ## Step 5: Non-Interactive Onboarding Choose the onboarding command based on the user's LLM provider. ### Anthropic (Claude) ```bash theme={null} ssh root@"$DROPLET_IP" "bash -s" <' ssh root@"$DROPLET_IP" 'openclaw gateway restart' ``` *** ## Step 8: Access the Dashboard The gateway binds to loopback by default. Three options for remote access: ### Option A: SSH Tunnel (simplest) From the local machine. First check if the local port is already in use: ```bash theme={null} # Check if port 18789 is free locally lsof -i :18789 2>/dev/null && echo "Port in use — pick another local port or kill the process" || echo "Port free" # Open the tunnel (use a different local port if 18789 is taken, e.g. -L 18790:localhost:18789) ssh -f -N -L 18789:localhost:18789 root@"$DROPLET_IP" ``` Then open: `http://localhost:18789/chat?session=main` The gateway token is needed for auth. Retrieve it: ```bash theme={null} ssh root@"$DROPLET_IP" "python3 -c \"import json; print(json.load(open('/root/.openclaw/openclaw.json'))['auth']['token'])\"" ``` ### Option B: Tailscale Serve (HTTPS, no port exposure) ```bash theme={null} ssh root@"$DROPLET_IP" 'bash -s' <<'TAILSCALE' curl -fsSL https://tailscale.com/install.sh | sh tailscale up openclaw config set gateway.tailscale.mode serve openclaw gateway restart TAILSCALE ``` Then open `https:///` from any device on your tailnet. ### Option C: Tailnet bind ```bash theme={null} ssh root@"$DROPLET_IP" 'bash -s' <<'TAILNET' openclaw config set gateway.bind tailnet openclaw gateway restart TAILNET ``` Open `http://:18789` (token required). *** ## Step 9: Connect Channels (optional) ### Telegram Requires a bot token from [@BotFather](https://t.me/BotFather). Once you have it: ```bash theme={null} ssh root@"$DROPLET_IP" "openclaw config set channels.telegram.enabled true" ssh root@"$DROPLET_IP" "openclaw config set channels.telegram.botToken \"$TELEGRAM_BOT_TOKEN\"" ssh root@"$DROPLET_IP" "openclaw gateway restart" ``` **Important:** After enabling Telegram, the user will likely message the bot immediately and receive a pairing code. The agent should be ready to approve it right away — don't wait for the user to ask: ```bash theme={null} # Approve a pairing code (the user will send this code from Telegram) ssh root@"$DROPLET_IP" 'openclaw pairing approve telegram ' ``` To list pending codes if needed: ```bash theme={null} ssh root@"$DROPLET_IP" 'openclaw pairing list telegram' ``` ### WhatsApp WhatsApp requires QR code scanning (interactive): ```bash theme={null} ssh -t root@"$DROPLET_IP" 'openclaw channels login whatsapp' ``` ### Discord, Slack, others See the channel-specific docs: [https://docs.openclaw.ai/channels/index.md](https://docs.openclaw.ai/channels/index.md) *** ## Troubleshooting ### Out of memory during setup ```bash theme={null} # Check memory ssh root@"$DROPLET_IP" 'free -h' # Increase Node heap ssh root@"$DROPLET_IP" 'export NODE_OPTIONS="--max-old-space-size=1536" && openclaw onboard --install-daemon' # Or resize the droplet (if using the $6 plan) doctl compute droplet-action resize openclaw1 --size s-1vcpu-2gb --wait ``` ### Gateway won't start ```bash theme={null} ssh root@"$DROPLET_IP" 'openclaw gateway status && openclaw doctor --non-interactive' ssh root@"$DROPLET_IP" 'journalctl -u openclaw --no-pager -n 50' ``` ### Port already in use (on the droplet) ```bash theme={null} ssh root@"$DROPLET_IP" 'lsof -i :18789' ssh root@"$DROPLET_IP" 'kill ' ``` ### Port already in use (local — SSH tunnel won't bind) ```bash theme={null} # Find what's using the port locally lsof -i :18789 # Either kill the existing process, or use a different local port: ssh -f -N -L 18790:localhost:18789 root@"$DROPLET_IP" # Then access at http://localhost:18790/chat?session=main ``` ### Model not found ```bash theme={null} # List all available models for your auth ssh root@"$DROPLET_IP" 'openclaw models list --all' # Set a valid model ssh root@"$DROPLET_IP" 'openclaw models set ' ssh root@"$DROPLET_IP" 'openclaw gateway restart' ``` *** ## Teardown ```bash theme={null} doctl compute droplet delete openclaw1 --force ``` *** ## Quick Reference | Task | Command | | --------------- | --------------------------------------------------------------- | | Check status | `ssh root@$IP 'openclaw status'` | | View logs | `ssh root@$IP 'openclaw logs --follow'` | | Restart gateway | `ssh root@$IP 'openclaw gateway restart'` | | Update OpenClaw | `ssh root@$IP 'npm install -g openclaw@latest'` | | Change model | `ssh root@$IP 'openclaw models set '` | | Backup config | `ssh root@$IP 'tar -czvf ~/openclaw-backup.tar.gz ~/.openclaw'` | | Run diagnostics | `ssh root@$IP 'openclaw doctor --non-interactive'` | *** ## Step 10: Install AgentCash (required) After OpenClaw setup is complete, **always** run this on the VM to install AgentCash — it gives OpenClaw access to all paid APIs from a single USDC balance: ```bash theme={null} ssh root@"$DROPLET_IP" 'npx agentcash@latest onboard' ``` Then have the user visit [**agentcash.dev**](https://agentcash.dev) to onboard — they'll get free credits and can manage their balance for all paid API access from one place. ## Step 11: Give a prompt to the user to paste in their agent (optional) Ask the user for their email address, and then give them a prompt that says: Email (user's email) using agentcash and stableemail. Email them a "Welcome to OpenClaw and AgentCash!" message. Send them important information about their agent, like it's username, IP address, and how to troubleshoot it going forward. *** ## Related Docs * CLI Automation: [https://docs.openclaw.ai/start/wizard-cli-automation.md](https://docs.openclaw.ai/start/wizard-cli-automation.md) * CLI Setup Reference: [https://docs.openclaw.ai/start/wizard-cli-reference.md](https://docs.openclaw.ai/start/wizard-cli-reference.md) * Onboard command: [https://docs.openclaw.ai/cli/onboard.md](https://docs.openclaw.ai/cli/onboard.md) * Gateway config: [https://docs.openclaw.ai/gateway/configuration.md](https://docs.openclaw.ai/gateway/configuration.md) * Tailscale setup: [https://docs.openclaw.ai/gateway/tailscale.md](https://docs.openclaw.ai/gateway/tailscale.md) * Channels: [https://docs.openclaw.ai/channels/index.md](https://docs.openclaw.ai/channels/index.md) * VPS hosting: [https://docs.openclaw.ai/vps.md](https://docs.openclaw.ai/vps.md) # OpenClaw setup for humans Source: https://agentcash.dev/docs/openclaw-setup/for-humans Set up OpenClaw on a DigitalOcean droplet by giving your AI agent a single prompt. The easiest way to set up OpenClaw is to let your AI agent do it. Copy the prompt below into your agent (Claude Code, Cursor, Codex, etc.) and it will handle everything. ## What you'll need Before you start, have these ready: * Claude Code, Cursor, or Codex to run the prompt in * A Telegram account (or WhatsApp, Discord, Signal, etc.). Our prompt works best with Telegram. Download it [here](https://telegram.org/apps). * A **DigitalOcean account** (or willingness to create one) * An **LLM provider API key** (Anthropic, OpenAI, etc.) or use oauth through Codex (more difficult) * An **SSH key** on your local machine (the agent can generate one if needed) ## Get started Read [https://agentcash.dev/docs/openclaw-setup/for-agents.md](https://agentcash.dev/docs/openclaw-setup/for-agents.md) and follow the guide to set up OpenClaw on a DigitalOcean droplet for me. Walk me through any prerequisites I need to set up first, then handle the rest. The agent will: 1. Check prerequisites (SSH key, `doctl`, DigitalOcean API token) 2. Create a droplet 3. Install Node.js and OpenClaw 4. Run non-interactive onboarding with your LLM provider 5. Verify the gateway is running 6. Set up remote access (SSH tunnel) 7. Install AgentCash for paid API access The agent will ask you for your API keys and preferences along the way. If you're using OAuth-based auth (like OpenAI Codex), the agent will tell you when you need to step in for the browser login. # Agent quickstart Source: https://agentcash.dev/docs/quickstart-agents Onboard, claim up to $25 in credits, and connect AgentCash to your AI agent. ## 1. Onboard and get free credits Connect a social account, get a personalized bonus, and start using AgentCash in minutes. ### What happens when you onboard The web onboarding flow at [agentcash.dev/onboard](https://agentcash.dev/onboard) takes you through four steps: Sign in with GitHub, Twitter, or LinkedIn. Connecting more accounts increases your bonus. An AgentCash agent analyzes your profiles to determine your sign-up bonus (up to \$25 in USDC). You can watch the research happen in real time. See your score and bonus amount. Click to generate a single-use claim code. Paste the provided prompt into your AI agent (Cursor, Claude Code, etc.). It runs `npx agentcash@latest onboard `, which sets up your local wallet, installs the AgentCash skill, configures MCP for your clients, and redeems your bonus on-chain. ### Alternative: onboard from the terminal If you already have a claim code or want to skip the web flow: ```bash theme={null} npx agentcash@latest onboard ``` Running without a code and with no existing balance will link you to the web onboarding. ## 2. Give your agent the skill The simplest way to connect AgentCash to your agent is through the skill file. Add this URL to your agent's context or configuration: ``` agentcash.dev/skill.md ``` This teaches your agent how to discover and use all available premium APIs. Add a rule file at `.cursor/rules/agentcash.md` with: ```markdown theme={null} Set up agentcash.dev/skill.md ``` Or just tell your agent: "Set up agentcash.dev/skill.md" Add to your `CLAUDE.md` or tell Claude directly: ``` Set up agentcash.dev/skill.md ``` Or install as an MCP server for tool-based access: ```bash theme={null} claude mcp add agentcash --scope user -- npx -y agentcash@latest ``` Point your agent at `agentcash.dev/skill.md`, or install [MCP mode](/docs/mcp-mode) for direct tool access. If you onboarded through the web flow, the CLI already installed the skill and configured MCP for detected clients. You can skip this step. ## 3. Ask your agent to do something Ask your agent to use any premium API. For example: > Use AgentCash to look up the company "Anthropic" on stableenrich.dev. The agent will: 1. Discover available APIs 2. Check the price 3. Pay with USDC from your wallet 4. Return the results You're set up. Your agent can now access 3,200+ premium APIs. ## Next steps Browse available services and their pricing. Use AgentCash directly from the terminal. Run AgentCash as an MCP server in your AI client. Understand the x402 and MPP payment flows under the hood. # Provider quickstart Source: https://agentcash.dev/docs/quickstart-providers Use an AI coding agent to make your API discoverable and payable through AgentCash. Copy and paste this prompt into your coding agent and it will figure out where you are and what you need in order to start selling to agents. Read [https://agentcash.dev/merchants.md](https://agentcash.dev/merchants.md) and follow the guide to make my API discoverable and payable by agents. Do everything automatically. Only ask me if you need input you can't determine yourself. Whether you're building from scratch, wrapping an existing API, or already supporting x402 or MPP, your agent will classify your situation automatically and walk you through the next steps. Have questions? [Chat with us](mailto:mason@merit.systems). # Sell to agents Source: https://agentcash.dev/docs/sell-to-agents Start onboarding agents as customers. ## Why sell to agents? AI agents are becoming the primary way people interact with the internet. As more activity flows through agent interfaces instead of browsers, ad-based business models break since there are no human eyeballs to monetize. The businesses that thrive will be the ones that charge for their content and services directly. Most agent users have never called an API before. Pay-per-request pricing at fractions of a cent opens your service to a massive new audience that your existing subscription tiers never reach. AgentCash becomes the tip of the spear for your go-to-market. ## Start selling to agents Add a few lines of code to enable pay-per-call, publish a discovery specification, and AI Agents can start calling your API. We support open payment standards like [x402](https://www.x402.org) and [MPP](https://docs.stripe.com/payments/machine). A few lines of code enable per-request pricing. AI Agents pay automatically. No subscriptions, no invoices. Add a simple file that tells AI Agents what your API does, what it costs, and how to call it. [See how](/docs/discovery). AI Agents discover your API and start calling it. You get immediate distribution to Claude, Cursor, Codex, and every agent on x402 or MPP. # Supercharge your agent Source: https://agentcash.dev/docs/start-agent AgentCash equips your agent with native access to the Open Agentic Web. Enrichment, social data, image generation, web scraping, email. All accessible instantly. Claude Code, Cursor, Codex, Windsurf, OpenClaw, Hermes, and 14+ more clients. No subscriptions. Calls cost fractions of a cent to a few cents each. Fund once, use everywhere. Agent skill, CLI, or MCP mode. Use whichever fits your workflow. ## What can your agent do with AgentCash? Agents with AgentCash can access premium data and services that would normally require separate accounts, API keys, and subscriptions for each provider: | Category | Examples | | ----------------------------- | --------------------------------------------------------- | | **People & company research** | Contact info, company data, LinkedIn profiles, org charts | | **Social media data** | Instagram, TikTok, YouTube, Reddit, Facebook | | **Web search & scraping** | Exa search, Google Maps, Firecrawl scraping | | **Image & video generation** | State-of-the-art AI media creation | | **File hosting** | Upload files, get permanent download URLs | | **Email** | Send transactional and outreach emails | ## Three ways to use AgentCash Choose how your agent connects — one shared balance, three entry points. Tell your agent to read `agentcash.dev/skill.md` and it will learn to discover and call premium APIs on its own. Run `npx agentcash` commands directly from your terminal to discover APIs, check balances, and make calls. Install AgentCash as an [MCP server](/docs/mcp-mode) for native tool integration in Claude Code, Cursor, and other clients. # Suggested frameworks Source: https://agentcash.dev/docs/suggested-frameworks High-level architectures for building agent-payable services. ## Proxy architecture Restructuring your backend and database to support agentic payments can be a daunting, time-consuming task, and in most cases it isn't strictly necessary to bring your service online. The pattern below lets you add agentic commerce support with minimal changes to your production architecture. ### Overview You stand up a thin proxy in front of your existing backend. The proxy should handle everything x402/mpp-specific. Payment verification, wallet identity, per-wallet authorization, rate limiting, and discovery exist in this service while your production API stays untouched. ```mermaid theme={null} flowchart LR agent["Agent"] -- "x402/MPP" --> proxy["Proxy"] proxy -- "API key" --> api["Production API"] proxy --- features["Payment verify\nWallet identity\nPer-wallet authz\nRate limiting\nDiscovery doc"] proxy --- db["Wallet mapping DB"] ``` ### How it works Stand up a separate server (we typically use Next.js, but any HTTP framework works). Provision a single API key from your production backend with "god-mode" permissions: as much spend authority and as few rate limits as possible. The proxy then acts as a pure consumer of your production API, wrapping each endpoint you want to expose over x402/MPP with a corresponding payable endpoint on the proxy. All agentic traffic to your production backend appears under a single API key. The complexity of per-wallet accounting stays isolated in the proxy, so your original backend's data model is unchanged. ### Responsibility split | Concern | Proxy server | Production API | | ------------------------------------ | ------------ | -------------- | | Payment verification (x402/MPP) | ✅ | — | | Wallet identity | ✅ | — | | Per-wallet authorization | ✅ | — | | Per-wallet rate limiting | ✅ | — | | Discovery document (`/openapi.json`) | ✅ | — | | Business logic | — | ✅ | | User records, billing, quotas | — | ✅ | | Long-term data storage | — | ✅ | The proxy owns everything agent-specific. The production API owns everything you already had. ### Wallet identity Each x402 or MPP request carries a signed payment proof. The proxy verifies the signature and treats the signing wallet address as the caller's identity. That wallet address becomes the primary key for owned resources, rate limits, session state, or anything else you track per-caller. If you also need free endpoints gated by wallet identity without payment, use SIWX (Sign-In with X). The signature flow is the same, but no funds move. ### Wallet-aware authorization Because every agent call reaches your production API under a single god-key, the proxy must enforce per-wallet authorization itself. The production API will happily return every row the key can see. It's the proxy's job to filter. For example, if your API exposes `list_jobs()`: * **Wrong:** the proxy calls `list_jobs()` and returns the full response. This leaks every wallet's jobs to every caller. * **Right:** the proxy looks up which job IDs belong to the calling wallet in its own database, fetches only those from the production API, and returns the filtered set. The same rule applies to `get_job`, `update_job`, and delete operations. Any endpoint that takes a resource ID must verify that the calling wallet owns that resource before proxying through. ### Rate limiting The god-key is intentionally provisioned with loose or absent rate limits so that legitimate agent traffic isn't throttled. The tradeoff is that the proxy is now the only thing standing between an abusive wallet and your production backend. Apply per-wallet rate limits at the proxy by request count, by spend, or both. ### Failure semantics x402 and MPP settle payment as part of the request. If the downstream call to your production API fails after settlement, you have two options: 1. **Don't settle on failure.** Validate upstream health and cheap preconditions before accepting payment, and return `402` on predictable failures. 2. **Refund on failure.** Catch downstream errors and issue a refund through the settlement network before returning `5xx` to the caller. Pick one policy per endpoint and document it. The worst outcome is silently charging a wallet for a failed request. ### Wallet mapping database If you need to track which wallets own which resources, a lightweight database alongside the proxy is usually enough. Common tables: * `wallet_address → owned_resource_ids` for ownership lookups. * `wallet_address → usage_counters` for rate limiting and spend caps. * `wallet_address → session_state` for stateful workflows. All of this sits outside your production database. From the production API's perspective, nothing changed and it still sees a single API key making calls. ### Exposing discovery The proxy is also where you serve your AgentCash discovery document. Publish `/openapi.json` on the proxy origin with `x-payment-info` and `402` responses on each payable operation. Agents discover and call the proxy and never the production API directly. See [Server Discovery](/docs/discovery) for the full OpenAPI contract. ### When this pattern fits Good fit: * You want to expose existing endpoints over x402/MPP with minimal risk to production. * Your business logic is already accessible via a clean internal API. * Per-wallet state is shallow enough to live in a sidecar database. ### Questions? For further questions, contact us at [team@merit.systems](mailto:team@merit.systems). # check_endpoint_schema Source: https://agentcash.dev/docs/tools/check-endpoint-schema Probe an endpoint for pricing, auth requirements, and schema without paying. The `check_endpoint_schema` tool inspects an endpoint to learn its price, supported methods, input/output schema, and auth mode without making a payment. Equivalent CLI command: `npx agentcash check ` ## Parameters The endpoint URL to check. Specific HTTP method to probe. If omitted, AgentCash probes multiple methods and checks the OpenAPI spec. Additional headers to include. Each entry must use `Name: value` format. ## Response Cost per request in USDC. Supported HTTP methods (GET, POST, etc.). Expected request body format (JSON schema). Response body format (JSON schema). Authentication mode: `x402`, `siwx`, `mpp`, or `none`. ## Behavior 1. Sends a probe request to the endpoint 2. Reads the `402 Payment Required` response for pricing and auth details 3. Fetches the OpenAPI spec (if available) for schema information 4. Probes multiple HTTP methods in parallel to determine which are supported 5. Returns all metadata without making a payment ## Example Ask your agent: > Check the pricing and schema for [https://stableenrich.dev/api/company/lookup](https://stableenrich.dev/api/company/lookup) using AgentCash. # discover_api_endpoints Source: https://agentcash.dev/docs/tools/discover-api-endpoints Find all available endpoints on an origin. The `discover_api_endpoints` tool fetches the OpenAPI document from an origin and returns a list of all available endpoints. Works with any origin that publishes a spec, not just the pre-indexed ones. Equivalent CLI command: `npx agentcash discover ` ## Parameters The origin URL to discover endpoints on (e.g., `https://stableenrich.dev`). ## Response The origin that was queried. List of discovered endpoints. Endpoint path. HTTP method. What the endpoint does. Cost in USDC. Usage instructions from the origin, if provided. ## Behavior 1. Fetches `/openapi.json` from the origin (falls back to `/.well-known/x402`) 2. Parses the OpenAPI document and its `x-payment-info` annotations 3. Returns endpoints with their descriptions, pricing, and accepted protocols ## Known origins These origins are pre-indexed and available by default: * `stableenrich.dev` * `stablesocial.dev` * `stablestudio.dev` * `stableupload.dev` * `stableemail.dev` ## Example Ask your agent: > Discover all available endpoints on stableenrich.dev using AgentCash. # fetch Source: https://agentcash.dev/docs/tools/fetch Make HTTP requests with automatic SIWX authentication and payment handling. The `fetch` tool sends an HTTP request to any URL and automatically handles SIWX authentication and payment if the endpoint requires them. Equivalent CLI command: `npx agentcash fetch ` ## Parameters The URL to fetch. HTTP method. One of `GET`, `POST`, `PUT`, `PATCH`, `DELETE`. Raw request body string. When provided, `Content-Type: application/json` is set by default unless overridden by a header entry. Additional HTTP headers. Each entry must be a string in `Name: value` format. Request timeout in milliseconds. Force a specific payment protocol: `x402` or `mpp`. By default, AgentCash auto-selects. Preferred network for SIWX and payment when applicable. By default, AgentCash auto-selects. Maximum amount (in USD) to pay if the route still requires payment. ## Response The tool returns the response body along with payment metadata when a payment was made: The parsed response body from the endpoint. Payment details, present when a 402 payment was made. USDC amount paid. On-chain transaction hash. Chain used for the payment. ## Behavior 1. Sends the request to the target URL 2. If the response is `402 Payment Required` with a SIWX challenge, signs the challenge and retries with auth headers 3. If the route still returns `402`, reads the accepted protocols (`x402`, `mpp`) and networks from the challenge 4. Picks a protocol/network your wallet supports and checks the balance against the required amount 5. Signs the payment proof (on-chain USDC transfer for x402, off-chain signed intent for MPP) 6. Retries the request with the payment proof attached 7. Returns the final response and payment info ## Example Ask your agent: > Use AgentCash to POST to [https://stableenrich.dev/api/company/lookup](https://stableenrich.dev/api/company/lookup) with body `{"domain": "stripe.com"}`. # fetch_with_auth Source: https://agentcash.dev/docs/tools/fetch-with-auth Compatibility alias for fetch. The `fetch_with_auth` tool is a deprecated compatibility alias for [`fetch`](/docs/tools/fetch). It uses the same unified flow: probe the route, attempt SIWX (Sign-In With X) when available, and only pay if the route still returns `402`. Equivalent CLI command: `npx agentcash fetch-auth ` (deprecated alias for `npx agentcash fetch `) ## Parameters The URL to fetch. HTTP method. One of `GET`, `POST`, `PUT`, `PATCH`, `DELETE`. Raw request body string. Additional HTTP headers. Each entry must be a string in `Name: value` format. Request timeout in milliseconds. ## Response The parsed response body from the endpoint. Payment details, present when the request still required payment after the SIWX retry. ## Behavior 1. Sends the initial request 2. If the response includes a SIWX challenge, extracts the challenge 3. Signs the challenge with your wallet's private key 4. Retries the request with signed auth headers 5. If the route still returns `402`, pays and retries again 6. Returns the final response ## When to use Prefer `fetch` for new integrations. Keep `fetch_with_auth` only for compatibility with older prompts or clients. # get_balance Source: https://agentcash.dev/docs/tools/get-balance Get your total wallet balance. The `get_balance` tool returns your total USDC balance across all supported networks. Equivalent CLI command: `npx agentcash balance` ## Parameters This tool takes no parameters. ## Response Total USDC balance across all supported networks. ## Behavior * Creates the wallet automatically at `~/.agentcash/wallet.json` if one does not exist * Aggregates balances across all supported payment networks * Use this before paid API calls to confirm that funds are available ## Example Ask your agent: > What is my AgentCash balance? # get_wallet_info (legacy) Source: https://agentcash.dev/docs/tools/get-wallet-info Deprecated combined wallet tool. The `get_wallet_info` tool has been replaced by two tools: * [`get_balance`](/docs/tools/get-balance) for total balance * [`list_accounts`](/docs/tools/list-accounts) for per-network balances, addresses, and deposit links Equivalent CLI commands: * `npx agentcash balance` * `npx agentcash accounts` ## Migration Use `get_balance` when you only need to know whether paid endpoints are currently affordable. Use `list_accounts` only when you need network-specific funding details, such as deposit links or wallet addresses. # list_accounts Source: https://agentcash.dev/docs/tools/list-accounts List wallet accounts and deposit links by network. The `list_accounts` tool returns the per-network account list for your AgentCash wallet, including balance, wallet address, and deposit link for each supported network. Equivalent CLI command: `npx agentcash accounts` ## Parameters This tool takes no parameters. ## Response One entry per supported network. Supported network name. USDC balance on that network. Wallet address for that network. Funding link for that network. Whether the wallet is new and likely needs funding. Present when the user has not completed onboarding. Show its message when returned. ## Behavior * Creates the wallet automatically at `~/.agentcash/wallet.json` if one does not exist * Returns funding details only when you need network-specific deposit instructions * Prefer [`get_balance`](/docs/tools/get-balance) when you only need to know whether funds are available ## Example Ask your agent: > If I need to fund my AgentCash wallet, what deposit links can I use? # redeem_invite Source: https://agentcash.dev/docs/tools/redeem-invite Redeem an invite code for free USDC. The `redeem_invite` tool redeems an invite code to deposit USDC into your wallet on Base. Equivalent CLI command: `npx agentcash redeem ` ## Parameters The invite code to redeem. ## Response Amount of USDC deposited. On-chain transaction hash on Base. ## Behavior * Sends the invite code to the AgentCash redemption service * Deposits USDC directly to your wallet on Base * Returns the amount and transaction hash Invite codes are one-time use. Each code can only be redeemed once. ## Example Ask your agent: > Redeem invite code ABC123 with AgentCash. # search Source: https://agentcash.dev/docs/tools/search Find API providers by describing what you need in natural language. The `search` tool finds paid API services that match a natural-language query. It returns ranked origins along with endpoint details and pricing, so you can call the best match immediately via [`fetch`](/docs/tools/fetch). Equivalent CLI command: `npx agentcash search ` ## When to use Use `search` when you don't already know which origin to call. If the task clearly maps to a registered origin (people research → StableEnrich, image generation → StableStudio, social data → StableSocial, and so on), skip `search` and call [`discover_api_endpoints`](/docs/tools/discover-api-endpoints) on that origin directly. `search` is for discovering capabilities outside the registered origins. ## Parameters Natural-language description of what you need. Examples: `"send physical mail"`, `"generate music"`, `"flight prices"`, `"company financials"`. ## Response The original query, echoed back. Ranked origins. The top result's `endpoint` includes the full input/output schema so it can be called without an extra `check_endpoint_schema` round-trip. Origin URL. Human-readable name. What the origin offers. Favicon URL. Payment protocols the origin supports (e.g., `x402`, `mpp`). Best-matching endpoint for the query, when one exists. HTTP method. Endpoint path. What the endpoint does. `paid` or `siwx`. Cost in USDC. Request body schema. Response schema. ## Behavior 1. Sends the query to the AgentCash search index 2. Returns a ranked list of origins and their most relevant endpoints 3. The top result is pre-loaded with schema details so you can go straight to `fetch` ## Example Ask your agent: > Use AgentCash to search for an API that can send a physical postcard. The agent calls `search`, picks the best matching origin, and then calls `fetch` on the endpoint it returned. # Funding your wallet Source: https://agentcash.dev/docs/wallet/funding How to add USDC to your AgentCash wallet. You need USDC in your wallet to make paid API calls. There are several ways to fund it. ## Get free credits The fastest way to get started is through the onboarding flow: Onboard at agentcash.dev/onboard to get up to \$25 in free credits. Or onboard from the terminal: ```bash theme={null} npx agentcash onboard ``` ## Redeem an invite code If you have an invite code, ask your agent: > Redeem invite code `YOUR_CODE` with AgentCash. Or use the CLI: ```bash theme={null} npx agentcash redeem YOUR_CODE ``` Invite codes are one-time use and deposit USDC directly to your wallet on Base. ## Deposit USDC directly Open the guided funding flow: ```bash theme={null} npx agentcash fund ``` Or, if you need the deposit links and addresses for each supported network: ```bash theme={null} npx agentcash accounts ``` You can also visit `agentcash.dev/deposit/` for a guided funding experience with options for bridging from other chains and on-ramps. Base is the default network for AgentCash payments and most endpoints accept USDC on Base. Your wallet also holds USDC on Solana. Fund that address only if you plan to call endpoints that require Solana. Run `npx agentcash accounts` to see deposit links for every supported network. ## Minimum balance There is no minimum balance requirement. Each API call costs a specific amount of USDC (typically $0.001 to $0.10 per request). AgentCash checks your balance before each payment and warns you if funds are insufficient. # Supported networks Source: https://agentcash.dev/docs/wallet/networks Blockchain networks supported for USDC payments. AgentCash pays endpoints in USDC across a small, curated set of networks. ## Networks | Network | CAIP-2 identifier | Type | Status | | ---------- | ----------------------------------------- | ------ | --------- | | **Base** | `eip155:8453` | EVM | Default | | **Solana** | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` | Solana | Supported | | Tempo | `eip155:4217` | EVM | Testnet | Base is the default for payments. Most endpoints accept USDC on Base and transaction costs are minimal. Solana support is available for endpoints that prefer it. ## Addresses Your wallet holds two distinct addresses: * **EVM address** — one Ethereum-style address covers every supported EVM network (Base, Tempo). * **Solana address** — a separate Solana keypair for USDC payments on Solana. Run `npx agentcash accounts` (or the [`list_accounts`](/docs/tools/list-accounts) MCP tool) to see each network's address, balance, and deposit link. ## Payment network selection The endpoint decides which network to use. The OpenAPI `x-payment-info` block or the runtime `402` response declares the accepted networks and protocols. AgentCash matches that against your wallet and pays on the correct chain automatically. You can override with `--payment-network` on the CLI or the `paymentNetwork` field on the MCP [`fetch`](/docs/tools/fetch) tool. # Wallet overview Source: https://agentcash.dev/docs/wallet/overview How AgentCash manages your local wallet for making payments. AgentCash creates and manages a local wallet that holds USDC for paying premium APIs. The wallet is created automatically the first time you use AgentCash. ## Where is the wallet stored? Your keys live under `~/.agentcash/` with restricted file permissions (`600`): * `wallet.json` — EVM keypair (covers Base and Tempo) * `solana-wallet.json` — Solana keypair Each file contains a private key, its address, and a creation timestamp. Private keys are stored in plaintext on disk. Do not share these files or commit them to version control. Anyone with the keys can spend your USDC. ## Using an existing key To use specific private keys, set environment variables: ```bash theme={null} export X402_PRIVATE_KEY=0xYOUR_EVM_PRIVATE_KEY # hex-encoded, 32 bytes export X402_SOLANA_PRIVATE_KEY=YOUR_SOLANA_SECRET_KEY # base58-encoded ``` Either variable can be set independently. You can choose to omit one if you don't want to use that chain. Useful for CI/CD environments or when you want multiple machines to share a wallet. ## Checking your balance Ask your agent: > What is my AgentCash balance? Or use the CLI directly: ```bash theme={null} npx agentcash balance ``` This returns your total USDC balance across supported networks. If you need deposit links or network-specific wallet addresses, run: ```bash theme={null} npx agentcash accounts ``` This returns the per-network account list, including each address, balance, and deposit link. ## Wallet addresses Your wallet exposes two addresses: * A single **EVM address** that receives USDC on every supported EVM network (Base, Tempo). * A separate **Solana address** for USDC on Solana. Run `npx agentcash accounts` to see each one along with its current balance and deposit link. See [networks](/docs/wallet/networks) for the full list. # What is AgentCash? Source: https://agentcash.dev/docs/what-is-agentcash Access 3,200+ premium APIs for research, enrichment, media generation, and more from any agent with a single CLI. No API keys. AgentCash is a CLI and agent skill that connects your agent to the [Open Agentic Web](https://merit.systems/blog/open-agentic-commerce), where thousands of independently-built services are registered and discoverable. Your agent can find what it needs, pay with stablecoin micropayments, and execute on your behalf. These APIs come from an open marketplace of merchants who list their services on [x402scan](https://x402scan.com) and [mppscan](https://mppscan.com). The catalog is growing every day, and any developer can add their own services to make them immediately accessible to millions of agents, the fastest-growing customer segment on the internet. No subscriptions or manual sign-up flows are required. Just tell your agent what you need. ## Get started Give your AI agent access to 3,200+ premium APIs. Sell your services to agents.