Skip to Content
For AgentsSkill Integration

Skill Integration

402claw publishes a skill definition that AI agents (like Claude Code) can load to understand how to use the gateway. This lets your agent automatically discover endpoints, make payments, and generate content.

What’s in the Skill?

The skill definition at https://402claw.cloud/skill.md teaches an agent:

  • The base URL and payment protocol
  • How to discover available endpoints
  • How to make X402-authenticated requests
  • How to poll for async results
  • Available parameters and error codes
  • Rate limits and best practices

Adding the Skill to Claude Code

Download the skill

curl -o ~/.claude/skills/use-402claw.md https://402claw.cloud/skill.md

Use it in conversation

Once installed, you can tell Claude:

“Use the 402claw skill to generate an image of a sunset”

Claude will:

  1. Fetch the agent manifest to discover endpoints
  2. Choose an appropriate endpoint
  3. Make the X402-authenticated request
  4. Poll for the result
  5. Return the image URL

Context to Provide Your Agent

When integrating 402claw with any AI agent, provide this context:

402claw.cloud is a pay-per-use AI gateway. No API keys needed — payment is authentication. Base URL: https://402claw.cloud Payment: USDC on Base (chain ID 8453) Protocol: X402 (automatic via x402-fetch library) To use: 1. GET /.well-known/agent-manifest.json to discover endpoints 2. POST /api/x402/{slug} with {"prompt": "..."} — payment is automatic with x402-fetch 3. Poll GET /api/task/{taskId} every 2s until status is "success" or "failed" Available tools needed: HTTP requests (fetch/curl), wallet signing (x402-fetch)

Required Agent Capabilities

Your agent needs these capabilities to use 402claw:

CapabilityPurpose
HTTP requestsFetch endpoints, submit generation requests, poll status
Wallet accessSign X402 payments (private key in environment)
JSON parsingParse API responses

Environment Variables

Set these for your agent:

WALLET_PRIVATE_KEY=0x... # Ethereum private key with USDC on Base

Never commit your private key to source control. Use environment variables or a secrets manager.

Tips for Agent Developers

  1. Always discover first — Fetch the agent manifest before making requests. Endpoints and prices can change.
  2. Handle async — All generation is async. Your agent must poll for results.
  3. Respect rate limits — 10 requests/minute for generation, 5 requests/second for polling.
  4. Budget awareness — Check endpoint prices before generating. Each request costs USDC.
  5. Error recovery — If a task fails, try a different prompt. The gateway auto-retries 3 times before marking as failed.
Last updated on