Developers
Developer Overview
For Developers
This section covers integrating ChainPe into your applications, agents, and AI frameworks.
Entry points by use case
| Use case | Package | Guide |
|---|---|---|
| Add USDC micropayments to any Node.js app | @chainpeavax/sdk | SDK Setup |
| Build a Vercel AI SDK agent that pays for APIs | @chainpeavax/ai-tools | AI Tools |
| Build a LangChain agent that pays for APIs | @chainpeavax/ai-tools | AI Tools |
| Build a standalone LLM agent with discovery+pay | @chainpeavax/agent | Agent Integration |
| Use Claude to pay for APIs | chainpe-wallet-mcp | Agent Integration |
Core SDK capabilities
The @chainpeavax/sdk package is the foundation. All other packages build on it.
import { ChainPe, RegistryClient, PolicyVaultClient, getReputation, giveFeedback } from '@chainpeavax/sdk'ChainPe class — the main entry point:
cp.fetch(url)— drop-in fetch with automatic x402 paymentcp.pay(url)— like fetch but returns structuredPaidResultcp.discover(query)— reputation-ranked service discoverycp.getReputation(agentId)— read ERC-8004 reputationcp.giveFeedback(agentId, score)— post ERC-8004 reputationcp.balance()— USDC + AVAX wallet balance
RegistryClient — direct registry access:
listAllServices()— paginated on-chain registry readfilterServices(services, options)— filter by query/tags/pricerankByReputation(rankedServices)— sort by ERC-8004 score
PolicyVaultClient — gasless spending:
deposit(),withdraw(),setPolicy(),revokeSession()signSpend()— agent signs off-chain (no gas)relaySpend()— relayer submits (pays gas)
Networks
ChainPe supports two networks:
type ChainPeNetwork = 'avalanche' | 'fuji'avalanche— Avalanche C-Chain mainnet (chainId 43114). Primary network.fuji— Avalanche Fuji testnet (chainId 43113). Use for development.
The network parameter in the constructor determines which RPC, USDC address, and registry address are used automatically.