Back to Skills

pay-for-service

Make a paid API request to an x402 endpoint with automatic USDC payment. Use when you or the user want to call a paid API, make an x402 request, use a paid service, or pay for an API call. Use after finding a service with search-for-service.

106stars38forksUpdated 5/16/2026

Security Assessment

Safe(100/100)
Security Score100/100

About pay-for-service

The `pay-for-service` skill enables users to make paid API requests to x402 endpoints using automatic USDC payments. It simplifies the process of interacting with paid services by combining API calls with wallet-based payments on the Base network. This skill addresses the challenge of securely and efficiently handling payments when accessing paid APIs, removing the need for manual payment processing and reducing the risk of errors or failed transactions. By streamlining both the payment and request steps into a single command, it allows developers and users to focus on the API functionality rather than the underlying payment mechanics.

The skill provides several capabilities, including automatic handling of USDC payments in atomic units, support for standard HTTP methods (GET, POST, etc.), and flexible options for query parameters, request headers, and request body data. It also supports limiting the maximum payment per request and grouping related operations with correlation IDs. Input validation ensures security by preventing shell injection and ensuring proper formatting of URLs, JSON data, and payment amounts. Users can also output results in JSON format for easier integration with other tools and workflows.

This skill is particularly useful for developers, data analysts, or technical users who need to interact with paid APIs without manual payment steps. Common use cases include making automated GET or POST requests to paid endpoints, sending structured data to API services, and managing USDC payment limits for budget control. Users must have an authenticated wallet with sufficient USDC balance, and the skill is best used in conjunction with the `search-for-service` skill to locate valid x402 endpoints before executing payments.

FAQ

How do I make a paid API request using this skill?

Use the command `npx [email protected] x402 pay <url>` with optional flags for HTTP method, data, headers, query parameters, and maximum payment. Ensure your wallet is authenticated and has sufficient USDC balance.

What wallet requirements are needed to use this skill?

Your wallet must be initialized and authenticated. You can check with `npx [email protected] status` and ensure it has enough USDC using `npx [email protected] balance`. If not authenticated, refer to the `authenticate-wallet` skill.

Can I limit how much USDC is spent per request?

Yes, you can use the `--max-amount` option to specify the maximum payment in USDC atomic units. For example, `--max-amount 100000` limits the payment to $0.10.

Which API endpoints are compatible with this skill?

Only x402 endpoints that require payment are compatible. If the endpoint is not valid, the skill will return 'No X402 payment requirements found'. Use the `search-for-service` skill to locate valid endpoints.

How is input validated to prevent errors?

The skill validates URLs to prevent shell injection, ensures JSON data for request body or headers is properly formatted and single-quoted, and checks that max-amount is a positive integer.

Install pay-for-service

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill