langchain-boltzpay
LangChain tools for BoltzPay -- pay for API data with AI agents.
Install
pip install langchain-boltzpay
Prerequisites
- Node.js 20+ (nodejs.org) -- the CLI bridge calls
npx @boltzpay/cliunder the hood - Coinbase CDP keys (docs) -- only needed for
fetch(paid requests)
Quick Start
from langchain_openai import ChatOpenAI
from langchain.agents import create_tool_calling_agent, AgentExecutor
from langchain_core.prompts import ChatPromptTemplate
from langchain_boltzpay import (
BoltzPayFetchTool,
BoltzPayDiagnoseTool,
BoltzPayDiscoverTool,
)
tools = [BoltzPayDiscoverTool(), BoltzPayDiagnoseTool(), BoltzPayFetchTool()]
llm = ChatOpenAI(model="gpt-4o-mini")
prompt = ChatPromptTemplate.from_messages([
("system", "You are a researcher. Use BoltzPay to access paid APIs."),
("human", "{input}"),
("placeholder", "{agent_scratchpad}"),
])
agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)
result = executor.invoke({"input": "Diagnose the endpoint invy.bot/api"})
Tool Reference
| Tool | Name | Description | Credentials? |
|---|---|---|---|
BoltzPayFetchTool |
boltzpay_fetch |
Fetch data from a paid API, auto-pay with USDC | Yes |
BoltzPayQuoteTool |
boltzpay_quote |
Get price quote without paying | No |
BoltzPayDiscoverTool |
boltzpay_discover |
Browse available paid APIs | No |
BoltzPayBudgetTool |
boltzpay_budget |
Show remaining spending budget | No |
BoltzPayHistoryTool |
boltzpay_history |
Show payment history | No |
BoltzPayWalletTool |
boltzpay_wallet |
Show wallet and config info | No |
BoltzPayDiagnoseTool |
boltzpay_diagnose |
Full endpoint diagnostic (protocol, health, latency) | No |
No Credentials Needed
Most tools work without any credentials -- perfect for exploration:
from langchain_boltzpay import BoltzPayDiscoverTool, BoltzPayDiagnoseTool
# Discover available APIs
discover = BoltzPayDiscoverTool()
print(discover._run())
# Diagnose an endpoint (protocol, health, latency)
diagnose = BoltzPayDiagnoseTool()
print(diagnose._run(url="https://invy.bot/api"))
With Credentials
To actually fetch paid data, set Coinbase CDP environment variables:
export COINBASE_API_KEY_ID="your-key-id"
export COINBASE_API_KEY_SECRET="your-key-secret"
export COINBASE_WALLET_SECRET="your-wallet-secret"
from langchain_boltzpay import BoltzPayFetchTool
fetch = BoltzPayFetchTool()
result = fetch._run(url="https://invy.bot/api")
print(result) # Paid API response with payment receipt
Error Handling
All tools set handle_tool_error=True, so LangChain agents handle errors gracefully. You can also catch errors directly:
from langchain_boltzpay import BoltzPayFetchTool
from langchain_boltzpay.errors import (
BoltzPayBridgeError,
BoltzPayNodeNotFoundError,
BoltzPayTimeoutError,
)
try:
tool = BoltzPayFetchTool()
tool._run(url="https://example.com/api")
except BoltzPayNodeNotFoundError:
print("Install Node.js 20+ from https://nodejs.org")
except BoltzPayTimeoutError:
print("CLI command timed out (default: 30s)")
except BoltzPayBridgeError as e:
print(f"CLI error [{e.code}]: {e.message}")
Jupyter Notebook
See notebooks/getting-started.ipynb for a complete walkthrough: discover APIs, check prices, and create an agent.
MCP Alternative
If you're using CrewAI or another MCP-compatible framework, you can use the BoltzPay MCP server directly instead of this LangChain package:
npx @boltzpay/mcp
This exposes the same 7 tools via the Model Context Protocol.
Links
Metadata
Release files for langchain-boltzpay 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| langchain_boltzpay-0.3.2.tar.gz | 9.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_boltzpay-0.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.5 kB
Release files / langchain_boltzpay-0.3.2.tar.gz
| Download URL | langchain_boltzpay-0.3.2.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d7528b2d35b32ae36cc99d95d156ee49c5def42dd644a360146840cd42b5379
|
|
BLAKE2b-256 checksum How to use checksums |
2a46386e7404809089f55a3699994344d7ec825e76b2f47379c4c5133fdf6613
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 1, 2026.
Transparency logRelease files / langchain_boltzpay-0.3.2-py3-none-any.whl
| Download URL | langchain_boltzpay-0.3.2-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10e566ce82e2f8d2bc3a4f5f8045568d67cd8d5e807ae50281cabbb9de86ad75
|
|
BLAKE2b-256 checksum How to use checksums |
b3c72310b02f027458fff081185b582f8bf659f8b98c214817145ad411c5b5c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 1, 2026.
Transparency log