Build AI agents with their own Bitcoin wallets and payment-gated APIs. No coding experience required.
An AI coding assistant that writes and runs code in your terminal.
Build in hours what used to take weeks.
Your AI gets its own Stacks wallet to hold and send funds.
Let your agent earn and spend on your behalf.
Payment-gated APIs that accept STX, sBTC, or USDCx.
Monetize your agent's work while you sleep.
Follow the steps below. Click each section to expand. ~30 min total
Claude Code lets you build with AI that can read, write, and run code. Choose whichever setup works best for you.
If you have the Claude desktop app, Claude Code is built right in. Just open a project folder and start building.
Prefer the command line? Install Claude Code globally via npm.
Step 1: Install Node.js
Go to https://nodejs.org and download the LTS version. Open the downloaded file and follow the installer prompts.
Step 2: Open a new Terminal window
Close Terminal and open it again. This ensures Node.js is ready to use.
Step 3: Install Claude Code
npm install -g @anthropic-ai/claude-code
Step 4: Run it
claude
The first time you run it, Claude Code will ask you to log in with your Anthropic account. Follow the prompts.
Your AI agent needs its own wallet to send and receive payments. We'll use the stx402 MCP to give Claude wallet capabilities.
Copy and paste this command into Claude Code:
claude mcp add stx402 npx stx402-agent -e NETWORK=mainnet
Claude will confirm the MCP server has been added.
Type this to Claude:
"Create a secure Stacks wallet"
Claude will ask you to set a password. Choose a strong password and remember it โ this encrypts your wallet locally.
That's it. Your agent now has a wallet.
Ask Claude:
"What is my wallet address?"
Send STX or sBTC to this address to fund your agent's wallet.
NETWORK=testnet in step 1, then get free test STX from the Stacks faucet.Once set up, your agent can:
Ask Claude "What can you do with my wallet?" to explore capabilities.
~/.stx402/). Never share your password or mnemonic phrase.x402 lets you charge for API access using crypto. When someone hits your endpoint without paying, they get a 402 "Payment Required" response. Once they pay, they get the content.
The easiest path โ consume AIBTC's existing endpoints:
# This returns 402 with payment requirements
curl https://x402.aibtc.dev/inference/chat
Ask Claude: "Help me write a script that calls x402.aibtc.dev and handles the payment flow."
Create your own payment-gated API:
# Clone the x402-api template
git clone https://github.com/aibtcdev/x402-api.git
cd x402-api
npm install
Ask Claude: "Help me add an endpoint that charges 0.001 STX to return a joke."
# Deploy to Cloudflare
npx wrangler login
npx wrangler deploy --env staging
Use the sponsor relay so your agent doesn't need STX for gas:
POST https://x402-relay.aibtc.dev/relay
Now you have all the pieces. Here's the complete flow:
Ask Claude:
Claude will help you set up routes, connect to an LLM, handle payments, and deploy.
Everything you need in one place.
Share what you build, get help, and connect with other builders.
Join AIBTC Discord