ihen404-x402-langchain
LangChain integration tool for HTTP 402 Paywalled Web Scraping powered by Base USDC micro-payments.
Designed specifically for Autonomous AI Agents, trading bots, and market research agents that require programmatic, pay-per-request web access without credit cards or monthly API subscriptions.
Features
- Native LangChain Tool Integration: Drop-in
X402WebScraperToolfor LangChain, LangGraph, and CrewAI agents. - Automated HTTP 402 Settlement: Automatically handles $0.005 Base USDC micro-payment challenges via
X-Paymentheaders. - Zero Friction for AI Agents: Autonomous agents sign and settle transactions directly on Base L2 in milliseconds.
Installation
pip install ihen404-x402-langchain
Quickstart
import os
from langchain_x402 import X402WebScraperTool
from langchain.agents import initialize_agent, AgentType
from langchain_openai import ChatOpenAI
# Initialize the 402-capable web scraper tool
scraper_tool = X402WebScraperTool(
wallet_private_key=os.getenv("BASE_WALLET_PRIVATE_KEY"),
rpc_url="[https://mainnet.base.org](https://mainnet.base.org)",
max_price_per_scrape="0.005" # Max USDC spend per request
)
llm = ChatOpenAI(model="gpt-4o", temperature=0)
agent = initialize_agent(
tools=[scraper_tool],
llm=llm,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
verbose=True
)
# Agent autonomously handles HTTP 402 payment challenge if paywalled
response = agent.run("Fetch data from [https://api.x402service.com/scrape?url=https://example.com](https://api.x402service.com/scrape?url=https://example.com)")
print(response)
Pricing Structure
| Action | Cost | Settlement Network |
|---|---|---|
| Standard Web Scrape | $0.005 USDC | Base (L2) |
| Failed Request | $0.000 USDC | N/A |
License
MIT License. Developed by @ihen404.
Metadata
Release files for ihen404-x402-langchain 1.0.1
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 |
|---|---|---|---|---|
| ihen404_x402_langchain-1.0.1.tar.gz | 3.9 kB | Without provenance | Details for ihen404_x402_langchain-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ihen404_x402_langchain-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for ihen404_x402_langchain-1.0.1-py3-none-any.whl |
Total release size: 8.2 kB
Release files / ihen404_x402_langchain-1.0.1.tar.gz
| Download URL | ihen404_x402_langchain-1.0.1.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b05a8678b949c678832e971f9cf2614ee772cff3cf472231a65ade1806dfedb0
|
|
BLAKE2b-256 checksum How to use checksums |
f5457ffae1b82687a5017c73b664105604c7466eab45cd49e0bab82ff8dd2d96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / ihen404_x402_langchain-1.0.1-py3-none-any.whl
| Download URL | ihen404_x402_langchain-1.0.1-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
456c3b89a3f671731c151e11163dd3db3fdcf8cd92c1ece7467c81f6423d769a
|
|
BLAKE2b-256 checksum How to use checksums |
d7b02a40a80132ce4bc66e820fde7e716a5c54e7476036fbe81b65c0e247fdc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for ihen404-x402-langchain 1.0.1
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.