How to pay
No account and no API key. Each paid call returns HTTP 402 until you pay, then one fresh JSON response. Pay in Bitcoin via Lightning (L402) or in USDC on Base (x402). One payment buys one successful response.
- Call the endpoint (or MCP tool) with no credential.
- Read the 402 JSON: price, Lightning invoice and macaroon, and the x402
acceptsrequirement (also in thePAYMENT-REQUIREDheader). - Pay one rail, then retry the same URL with the matching header. Only HTTP 200 is settled.
Full machine-readable reference: llms.txt · OpenAPI · MCP at /mcp.
Pay the invoice with any Lightning wallet, copy the 64-character preimage, and retry with:
Authorization: L402 <macaroon>:<preimage>
curl -sS -i https://api.bittuitive.ai/api/v1/data/btc_price
# pay the invoice in any Lightning wallet, copy the 64-char preimage, then:
curl -sS -H "Authorization: L402 <macaroon>:<preimage>" https://api.bittuitive.ai/api/v1/data/btc_priceOff-the-shelf clients: lnget and Lightning Labs aperture pay and retry for you. Subscriptions are Lightning only.
Sign the USDC-on-Base requirement (EIP-3009 transferWithAuthorization). The facilitator pays gas, so the wallet does not need ETH. Retry with the PAYMENT-SIGNATURE header (x402 v2). Example price for btc_price: $0.01 USDC.
JavaScript (npm i @x402/fetch @x402/evm viem):
npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.register("eip155:8453", new ExactEvmScheme(
privateKeyToAccount(process.env.EVM_PRIVATE_KEY)));
const paid = wrapFetchWithPayment(fetch, client);
const res = await paid("https://api.bittuitive.ai/api/v1/data/btc_price");
console.log(await res.json());Python (pip install "x402[httpx]" eth_account):
pip install "x402[httpx]" eth_account
import asyncio, os
from eth_account import Account
from x402 import x402Client
from x402.http.clients import x402HttpxClient
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact import ExactEvmScheme
async def main():
client = x402Client()
client.register("eip155:8453", ExactEvmScheme(
EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"]))))
async with x402HttpxClient(client) as http:
r = await http.get("https://api.bittuitive.ai/api/v1/data/btc_price")
print(r.status_code, await r.aread())
asyncio.run(main())Add https://api.bittuitive.ai/mcp as a remote Streamable HTTP server (no auth, no install). A paid tool called without a credential returns payment_required (isError=true). Then retry with l402_credential='<macaroon>:<preimage>', or put the signed x402 PaymentPayload in params._meta["x402/payment"] (or a base64 x402_payment argument).
- A used, expired, or wrong-endpoint credential gets a fresh 402. If the upstream fetch fails (502), the credential is not consumed.
- The 402 body includes a short how-to-pay block with these same examples, plus an illustrative sample (not live data).
- Keep the private key in an environment variable. BitTuitive™ never holds your funds or keys.