A command-line interface example demonstrating how to use the Bankr SDK with x402 payments. This example shows how to interact with the Bankr AI agent for DeFi operations using USDC micropayments.
- 🤖 Interactive CLI for Bankr AI agent
- 💰 x402 USDC payment integration
- 📊 Real-time feedback with loading indicators
- 🎨 Beautiful terminal UI with colors
- Bun runtime installed
- USDC on Base network for payments
- Private key for payment wallet
# Clone the repository
git clone https://github.com/BankrBot/x402-cli-example.git
cd x402-cli-example
# Install dependencies
bun install- Copy the example environment file:
cp .env-example .env- Edit
.envand add your configuration:
# Required: Payment wallet private key for x402 USDC payments
PRIVATE_KEY=0xYourPrivateKeyHere
# Optional: Context wallet for Bankr prompts and transactions
# If not provided, defaults to the address derived from PRIVATE_KEY
WALLET_ADDRESS=
# Optional: Enable debug mode to see full JSON responses
DEBUG=falseRun the CLI:
bun startFollow the interactive prompts to:
- Enter prompts for the Bankr AI agent
- View responses and estimated costs
- Confirm and execute transactions
- Monitor operation status
x402 is a payment protocol that enables micropayments for API calls. This example uses it to pay for:
- Interacting with Bankr
Payments are made in USDC on Base network, $0.10 per request.
MIT