Skip to main content

Install

npm install @boltzpay/ai-sdk ai @boltzpay/sdk

Quick Start

import { generateText } from "ai";
import { openai } from "@ai-sdk/openai";
import { boltzpayTools } from "@boltzpay/ai-sdk";

const { text } = await generateText({
  model: openai("gpt-4.1"),
  tools: boltzpayTools(),
  maxSteps: 5,
  prompt: "Discover available paid APIs and check prices",
});
No credentials needed. The agent can discover APIs, check prices, and get quotes for free.

Enable Payments

Pass your Coinbase CDP credentials to let the agent pay for API data:
const { text } = await generateText({
  model: openai("gpt-4.1"),
  tools: boltzpayTools({
    coinbaseApiKeyId: process.env.COINBASE_API_KEY_ID,
    coinbaseApiKeySecret: process.env.COINBASE_API_KEY_SECRET,
    coinbaseWalletSecret: process.env.COINBASE_WALLET_SECRET,
    budget: { daily: "5.00", perTransaction: "1.00" },
  }),
  maxSteps: 5,
  prompt: "Fetch the latest crypto data from https://invy.bot/api",
});

Pre-built SDK Instance

If you already have a BoltzPay instance, pass it directly:
import { BoltzPay } from "@boltzpay/sdk";
import { boltzpayTools } from "@boltzpay/ai-sdk";

const sdk = new BoltzPay({ /* config */ });
const tools = boltzpayTools(sdk);

Tools

ToolDescriptionCredentials
boltzpay_fetchFetch data from a paid API. Auto-detects protocol, pays, returns response.Yes
boltzpay_checkCheck if a URL requires payment. Returns protocol and price.No
boltzpay_quoteGet a detailed price quote with multi-chain options.No
boltzpay_discoverBrowse the directory of compatible paid APIs.No
boltzpay_budgetView current budget limits and spending.No
boltzpay_historyView payment history for this session.No
boltzpay_walletView wallet info, chains, and balances.No
Only boltzpay_fetch requires Coinbase credentials. All other tools work in read-only mode with boltzpayTools() (no config).