aibank
Getting Started

AI Agents

Integrate aibank with Claude, GPT, and other AI agents using the SDK or direct HTTP calls.

AI Agent Integration

aibank is designed to be the financial backbone for AI agents. Whether you're building with Claude (via MCP), GPT (via function calling), or any other agent framework, aibank provides the wallet, payment, and gateway infrastructure.

Using the SDK

The recommended way to integrate is through the TypeScript SDK:

bun add aibank
import { Aibank } from "aibank";

const aibank = new Aibank({
  apiKey: "ak_your_api_key",
  walletBaseUrl: "http://localhost:4000",
});

// Create a wallet for your agent
const wallet = await aibank.createWallet({ name: "claude-agent" });

// Check balances
const balances = await wallet.getBalances();

// Send a payment
await wallet.transfer({
  chain: "base",
  to: "0xRecipient",
  amount: "5.00",
  currency: "USDC",
});

// Browse the service catalog
const services = await aibank.catalog.listServices({ category: "data" });

Claude MCP integration

aibank provides an MCP server that exposes wallet and payment tools directly to Claude:

{
  "mcpServers": {
    "aibank": {
      "command": "npx",
      "args": ["aibank-mcp"],
      "env": {
        "AIBANK_API_KEY": "ak_your_api_key",
        "AIBANK_BASE_URL": "http://localhost:4000"
      }
    }
  }
}

Once configured, Claude can:

  • Check wallet balances
  • Send transfers
  • Browse and call services from the catalog
  • Make x402 payments automatically

Direct HTTP integration

For agents that prefer raw HTTP calls, all functionality is available through the REST API:

// Any agent can call the API directly
async function agentTransfer(apiKey: string, walletId: string) {
  const res = await fetch(`http://localhost:4000/v1/wallets/${walletId}/transfer`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-API-Key": apiKey,
    },
    body: JSON.stringify({
      chain: "base",
      to: "0xRecipient",
      amount: "1.00",
      currency: "USDC",
    }),
  });

  return res.json();
}

x402 payments

Agents can pay for API calls using the x402 protocol -- no API key needed:

// Automatic x402 with the SDK
const wallet = aibank.getWallet("wallet-id");
const response = await wallet.x402Fetch("http://localhost:4000/v1/gateway/anthropic/v1/messages");

When a 402 response is received, the SDK automatically:

  1. Reads payment requirements from response headers
  2. Sends USDC to the specified recipient
  3. Retries the request with the transaction hash as proof

Gateway usage

Route all your AI API calls through aibank's gateway for unified billing and logging:

// Instead of calling Anthropic directly:
const res = await fetch("http://localhost:4000/v1/gateway/anthropic/v1/messages", {
  method: "POST",
  headers: {
    "X-API-Key": "ak_your_key",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "claude-sonnet-4-20250514",
    max_tokens: 1024,
    messages: [{ role: "user", content: "Hello" }],
  }),
});

Supported providers:

ProviderGateway pathUpstream
Anthropic/v1/gateway/anthropic/*api.anthropic.com
OpenAI/v1/gateway/openai/*api.openai.com
DeepSeek/v1/gateway/deepseek/*api.deepseek.com
Groq/v1/gateway/groq/*api.groq.com/openai
GetBlock/v1/gateway/getblock/:chaingo.getblock.io
CoinGecko/v1/gateway/coingecko/*api.coingecko.com
Serper/v1/gateway/serper/*google.serper.dev

Agent capabilities matrix

CapabilitySDK methodREST endpoint
Create walletaibank.createWallet()POST /v1/wallets
Check balancewallet.getBalances()GET /v1/wallets/:id/balances
Transfer tokenswallet.transfer()POST /v1/wallets/:id/transfer
Swap tokenswallet.swap()POST /v1/wallets/:id/swap
Transaction historywallet.getTransactions()GET /v1/wallets/:id/transactions
Browse servicesaibank.catalog.listServices()GET /v1/catalog
Call serviceaibank.catalog.call()ALL /v1/proxy/:service_id/*
Trade on Hyperliquid--POST /v1/trading/hyperliquid
x402 auto-paywallet.x402Fetch()Automatic via headers

On this page