Calling Skills
Call paid skills with automatic x402 payment handling.
Calling Skills
The SDK handles the entire x402 payment flow automatically when you call a skill.
Basic Usage
How Payments Work
When you call market.call():
- Fetch skill info - SDK gets the skill's endpoint and price
- Make initial request - SDK calls the skill endpoint
- Handle 402 - Endpoint returns
402 Payment Required - Create payment - SDK creates a USDC transfer on Base
- Retry with proof - SDK retries with payment proof header
- Return result - Skill executes and returns the result
All of this happens automatically - you just await the result.
Requirements
To call paid skills, you need:
- A wallet with USDC on Base mainnet
- Sufficient balance for the skill's price
Error Handling
Handle common errors when calling skills:
Common Errors
| Error | Cause |
|---|---|
Wallet required for calling paid skills | No wallet provided to constructor |
Skill [slug] is not active | Skill is disabled by creator |
Skill call failed: ... | Skill endpoint returned an error |
Checking Skill Status
Before calling, you can check if a skill is active:
Typed Results
You can type the result for better type safety:
Submitting Feedback
After calling a skill, you can leave a review:
Authentication Flow
The SDK handles authentication automatically when you call feedback(), but you can also authenticate explicitly:
Example: Complete Workflow
Next Steps
- x402 Payments - Deep dive into the payment protocol
- Creator Guide - Learn to create your own skills