microtoll

microtoll

For BuildersAPI ProvidersDiscover APIs

Integration Guides

Connect Microtoll to your AI agent framework in minutes. One MCP server, all APIs, all frameworks.

Direct integration

Not using an MCP-compatible framework? Integrate directly with the Python SDK, TypeScript SDK, or raw HTTP.

Python SDKpip install microtoll

Automatic payment, retry with backoff, budget caps, credit management, and spending tracking.

from microtoll import Microtoll

async with Microtoll() as m:
    result = await m.call("tavily", "/search",
        json={"query": "latest AI news"})
    print(result.json())
TypeScript SDKnpm install microtoll

Same capabilities in TypeScript/Node.js: automatic payment, retry, budget tracking, and credit store.

import { Microtoll } from "microtoll";

const m = new Microtoll();
const result = await m.call("tavily", "/search",
  { json: { query: "latest AI news" } });
console.log(result.json);
Direct HTTP (L402)Any language, any HTTP client

Call any Microtoll API URL directly. On HTTP 402, pay the invoice from the response header, then retry with the preimage. Works from any language.

# 1. Call the API
curl https://microtoll.io/api/tavily/search -d '{...}'
# → 402 Payment Required + invoice in header

# 2. Pay the invoice with your Spark or Lightning wallet
# 3. Retry with the preimage in Authorization header

How it works

1

Set up a Spark wallet

Run microtoll setup to create or connect a wallet. Fund it from Lightning, USDC, or fiat.

2

Install microtoll-mcp

pip install microtoll-mcp — or use uvx for zero-install.

3

Configure your framework

Add Microtoll as an MCP server. Your agent gets 8 tools: search, estimate, call, wallet, spending, health, request, identify.

4

Your agent pays per request

No subscriptions. No per-API signups. Your agent discovers APIs, checks prices, and pays automatically.