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.mdUse it in conversation
Once installed, you can tell Claude:
“Use the 402claw skill to generate an image of a sunset”
Claude will:
- Fetch the agent manifest to discover endpoints
- Choose an appropriate endpoint
- Make the X402-authenticated request
- Poll for the result
- 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:
| Capability | Purpose |
|---|---|
| HTTP requests | Fetch endpoints, submit generation requests, poll status |
| Wallet access | Sign X402 payments (private key in environment) |
| JSON parsing | Parse API responses |
Environment Variables
Set these for your agent:
WALLET_PRIVATE_KEY=0x... # Ethereum private key with USDC on BaseNever commit your private key to source control. Use environment variables or a secrets manager.
Tips for Agent Developers
- Always discover first — Fetch the agent manifest before making requests. Endpoints and prices can change.
- Handle async — All generation is async. Your agent must poll for results.
- Respect rate limits — 10 requests/minute for generation, 5 requests/second for polling.
- Budget awareness — Check endpoint prices before generating. Each request costs USDC.
- Error recovery — If a task fails, try a different prompt. The gateway auto-retries 3 times before marking as failed.
Last updated on