langchain-x402
LangChain tools for 2,400+ x402 pay-per-call APIs. No wallet setup needed.
Install
pip install langchain-x402
Quick Start
from langchain_x402 import X402Toolkit
tools = X402Toolkit().get_tools()
# 3 tools: x402_discover, x402_call, x402_balance
With an Agent
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
from langchain_x402 import X402Toolkit
agent = create_react_agent(ChatOpenAI(), X402Toolkit().get_tools())
result = agent.invoke({
"messages": [("user", "Find DeFi security APIs and check if USDC on Base is safe")]
})
Tools
x402_discover
Search 2,400+ x402 APIs by keyword. Returns URLs, descriptions, prices.
from langchain_x402 import DiscoverTool
tool = DiscoverTool()
result = tool.invoke({"query": "weather forecast", "limit": 5})
x402_call
Call any x402 API. Payment handled automatically via broker ($0.01/call).
from langchain_x402 import CallAPITool
tool = CallAPITool()
result = tool.invoke({"url": "https://weather.hugen.tokyo/weather/current?city=Tokyo"})
x402_balance
Check remaining API key balance.
from langchain_x402 import BalanceTool
tool = BalanceTool()
result = tool.invoke({}) # {"balance_usd": 0.04}
How Billing Works
- First use auto-creates an API key with $0.05 trial credit (5 broker calls)
- Each
x402_calldeducts from balance - When balance runs out, top up via
POST https://discovery.hugen.tokyo/keys/topup($1.00) - Discovery search is free (no payment needed)
License
MIT
Metadata
Release files for langchain-x402-toolkit 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_x402_toolkit-0.1.0.tar.gz | 3.2 kB | Without provenance | Details for langchain_x402_toolkit-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_x402_toolkit-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for langchain_x402_toolkit-0.1.0-py3-none-any.whl |
Total release size: 6.9 kB
Release files / langchain_x402_toolkit-0.1.0.tar.gz
| Download URL | langchain_x402_toolkit-0.1.0.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c0501aa9a8e34b3db44cc3aa951c830c768d9d4c25f0c7d4072dca4df935097
|
|
BLAKE2b-256 checksum How to use checksums |
bddd045ebcb8a6ea7f417e85e67499e091602eed07399041aa8542f674bff24c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / langchain_x402_toolkit-0.1.0-py3-none-any.whl
| Download URL | langchain_x402_toolkit-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
50bac9133404b3201247123e3670a2f3fa68e6d111536e8f8aa7ef0d1641517f
|
|
BLAKE2b-256 checksum How to use checksums |
4e6bc962315025dfc8f10900fc116f1b01860121a2961c6dd3ba081be6cb9f6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for langchain-x402-toolkit 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.