Build an AI Agent with Crypto Wallet Access in 5 Minutes

Give your AI agent its own crypto wallet. Create HD wallets, check balances across 9 chains, get live price feeds, and execute token swaps — all with one API key and zero blockchain code.

March 3, 2026 5 min read Beginner friendly
What you'll build
  1. Why AI agents need wallets
  2. Architecture overview
  3. Get your API key (30 seconds)
  4. Create an HD wallet
  5. Check balances across chains
  6. Get live crypto prices
  7. Put it together: autonomous portfolio agent
  8. Next steps

1 Why AI agents need wallets

An AI agent that can only read and write text is limited. The next generation of agents will interact with the real world — and that includes money.

Use cases for wallet-enabled agents:

The hard part has always been the blockchain integration: managing private keys, signing transactions, handling different chains and token standards. Agent Gateway abstracts all of this behind a REST API.

2 Architecture overview

Your AI Agent (Python / Node.js / any language) | | REST API calls (Bearer token auth) v Agent Gateway (single API key, 200 free credits) | +---------+---------+-------------+ | | | | v v v v Wallet Prices On-chain 30+ more API API Analytics services | | | v v v ETH SOL CoinGecko Multi-chain BSC ARB Binance explorers BASE ... Kraken

Your agent talks to Agent Gateway. The gateway handles authentication, rate limiting, and routing to the right backend service. You get 200 free credits on key creation — no email, no credit card.

3 Get your API key (30 seconds)

One POST request. That's it.

bash
curl -X POST https://agent-gateway-kappa.vercel.app/api/keys/create
{ "api_key": "gw_a1b2c3d4e5f6...", "credits": 200, "message": "API key created. 200 free credits." }
Save your key
Store this API key securely. You'll use it as a Bearer token for all subsequent requests.

4 Create an HD wallet

Generate a hierarchical deterministic (HD) wallet that works across multiple chains. One seed phrase, addresses on every supported chain.

curl

bash
# Generate a new HD wallet
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-wallet/wallets/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"
{ "address": "0x742d35Cc6634C0532925a3b844Bc9e7595f2bD68", "chain": "ethereum", "mnemonic": "word1 word2 word3 ... word12", "privateKey": "0x..." }
Security note
The API returns the mnemonic and private key. In production, store these in a secrets vault (Agent Gateway has one at /v1/agent-secrets). Never log or commit private keys.

Python

python
import requests

API_KEY = "gw_your_key_here"
BASE = "https://agent-gateway-kappa.vercel.app"
headers = {"Authorization": f"Bearer {API_KEY}"}

# Create a new wallet
wallet = requests.post(f"{BASE}/v1/agent-wallet/wallets/generate", headers=headers).json()

print(f"Address: {wallet['address']}")
print(f"Chain:   {wallet['chain']}")

Node.js

javascript
const API_KEY = "gw_your_key_here";
const BASE = "https://agent-gateway-kappa.vercel.app";

const res = await fetch(`${BASE}/v1/agent-wallet/wallets/generate`, {
  method: "POST",
  headers: { "Authorization": `Bearer ${API_KEY}` }
});

const wallet = await res.json();
console.log("Address:", wallet.address);

Supported chains

The wallet API supports 9 chains: Ethereum, Polygon, Arbitrum, Optimism, Base, BSC, Avalanche, Fantom, and Solana. Derive addresses on any chain from the same seed:

bash
# Derive an address on a specific chain
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-wallet/wallets/derive \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"mnemonic": "your twelve word mnemonic phrase here ...", "chain": "base"}'

5 Check balances across chains

Query the native token balance for any address on any supported chain:

bash
# Check ETH balance
curl https://agent-gateway-kappa.vercel.app/v1/agent-wallet/wallets/0x742d.../balance \
  -H "Authorization: Bearer YOUR_API_KEY"
{ "address": "0x742d35Cc6634C0532925a3b844Bc9e7595f2bD68", "chain": "ethereum", "balance": "0.0", "symbol": "ETH" }

Check all chains at once:

bash
# Get balance on all supported chains
curl https://agent-gateway-kappa.vercel.app/v1/agent-wallet/wallets/0x742d.../balance/all \
  -H "Authorization: Bearer YOUR_API_KEY"

Check specific ERC-20 token balances:

bash
# Check USDC balance on Base
curl "https://agent-gateway-kappa.vercel.app/v1/agent-wallet/wallets/0x742d.../tokens/0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" \
  -H "Authorization: Bearer YOUR_API_KEY"

6 Get live crypto prices

Real-time price feeds for your agent's decision-making. No separate API key needed — it's included in your gateway key.

bash
# Get BTC, ETH, SOL prices
curl "https://agent-gateway-kappa.vercel.app/v1/crypto-feeds/api/prices" \
  -H "Authorization: Bearer YOUR_API_KEY"
{ "prices": { "BTC": {"price": 94250.00, "change24h": 2.3}, "ETH": {"price": 2680.50, "change24h": 1.8}, "SOL": {"price": 142.30, "change24h": -0.5} }, "timestamp": "2026-03-03T10:00:00Z" }

Get a specific token:

bash
curl "https://agent-gateway-kappa.vercel.app/v1/crypto-feeds/api/price/ETH" \
  -H "Authorization: Bearer YOUR_API_KEY"

Set up price alerts (your agent gets notified when thresholds are hit):

bash
# Alert when ETH drops below $2500
curl -X POST "https://agent-gateway-kappa.vercel.app/v1/crypto-feeds/api/alerts" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "symbol": "ETH",
    "condition": "below",
    "price": 2500,
    "webhook": "https://your-webhook.example.com/alert"
  }'

7 Put it together: autonomous portfolio agent

Here's a complete Python agent that creates a wallet, monitors prices, and reports portfolio status. This is a working script you can run right now.

python
import requests
import json
import time

# Configuration
BASE = "https://agent-gateway-kappa.vercel.app"

def create_api_key():
    """Get a free API key with 200 credits."""
    res = requests.post(f"{BASE}/api/keys/create")
    data = res.json()
    print(f"API Key: {data['api_key']}")
    print(f"Credits: {data['credits']}")
    return data["api_key"]

def create_wallet(api_key):
    """Generate a new HD wallet."""
    headers = {"Authorization": f"Bearer {api_key}"}
    res = requests.post(f"{BASE}/v1/agent-wallet/wallets/generate", headers=headers)
    wallet = res.json()
    print(f"Wallet created: {wallet['address']}")
    return wallet

def get_prices(api_key):
    """Fetch current crypto prices."""
    headers = {"Authorization": f"Bearer {api_key}"}
    res = requests.get(f"{BASE}/v1/crypto-feeds/api/prices", headers=headers)
    return res.json()

def get_balance(api_key, address):
    """Check wallet balance across all chains."""
    headers = {"Authorization": f"Bearer {api_key}"}
    res = requests.get(
        f"{BASE}/v1/agent-wallet/wallets/{address}/balance/all",
        headers=headers
    )
    return res.json()

def store_secret(api_key, key, value):
    """Store sensitive data in the secrets vault."""
    headers = {
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json"
    }
    requests.post(
        f"{BASE}/v1/agent-secrets/api/secrets",
        headers=headers,
        json={"key": key, "value": value}
    )

def run_agent():
    """Main agent loop."""
    # Step 1: Get API key
    api_key = create_api_key()

    # Step 2: Create wallet
    wallet = create_wallet(api_key)

    # Step 3: Securely store the private key
    store_secret(api_key, "wallet_pk", wallet.get("privateKey", ""))
    print("Private key stored in secrets vault")

    # Step 4: Monitor prices and balances
    print("\n--- Portfolio Agent Running ---")
    prices = get_prices(api_key)
    print(f"\nMarket prices:")
    for symbol, data in prices.get("prices", {}).items():
        price = data if isinstance(data, (int, float)) else data.get("price", data)
        print(f"  {symbol}: ${price}")

    # Check wallet balance
    balances = get_balance(api_key, wallet["address"])
    print(f"\nWallet {wallet['address'][:10]}... balances:")
    print(json.dumps(balances, indent=2))

    # Check remaining credits
    headers = {"Authorization": f"Bearer {api_key}"}
    usage = requests.get(f"{BASE}/api/usage", headers=headers).json()
    print(f"\nCredits remaining: {usage.get('credits_remaining', 'N/A')}")

if __name__ == "__main__":
    run_agent()

Node.js version

javascript
const BASE = "https://agent-gateway-kappa.vercel.app";

async function main() {
  // 1. Get API key
  const keyRes = await fetch(`${BASE}/api/keys/create`, { method: "POST" });
  const { api_key } = await keyRes.json();
  const headers = { "Authorization": `Bearer ${api_key}` };

  // 2. Create wallet
  const walletRes = await fetch(`${BASE}/v1/agent-wallet/wallets/generate`, {
    method: "POST", headers
  });
  const wallet = await walletRes.json();
  console.log("Wallet:", wallet.address);

  // 3. Store private key securely
  await fetch(`${BASE}/v1/agent-secrets/api/secrets`, {
    method: "POST",
    headers: { ...headers, "Content-Type": "application/json" },
    body: JSON.stringify({ key: "wallet_pk", value: wallet.privateKey })
  });

  // 4. Get prices
  const priceRes = await fetch(`${BASE}/v1/crypto-feeds/api/prices`, { headers });
  const prices = await priceRes.json();
  console.log("Prices:", prices);

  // 5. Check balance
  const balRes = await fetch(
    `${BASE}/v1/agent-wallet/wallets/${wallet.address}/balance/all`,
    { headers }
  );
  console.log("Balances:", await balRes.json());
}

main();

Start building in 30 seconds

200 free credits. No email. No credit card. One API key for 39 services.

Get Started Guide Browse All APIs