Skip to main content

AproxPay LangChain

LangChain tools for AproxPay — residential proxy with native x402 payments (USDC on Base). No signup, no API key: a buyer wallet signs EIP-3009 transfers per request or session pass.

Two packages in this repo:

Runtime Package Install
Python langchain-aproxpay pip install langchain-aproxpay
JavaScript langchain-aproxpay npm i langchain-aproxpay @langchain/core

Every request sets X-Client-Source: langchain so AproxPay funnel metrics attribute traffic correctly.

Quickstart (Python)

pip install langchain-aproxpay
export APROXPROXY_PRIVATE_KEY=0x…   # dedicated low-balance buyer wallet on Base
from langchain_aproxpay import AproxPayProxyGetTool, create_aproxpay_tools

tool = AproxPayProxyGetTool()  # reads APROXPROXY_PRIVATE_KEY from env
print(tool.invoke({"url": "https://api.ipify.org?format=json"}))

# Or bind the full set:
tools = create_aproxpay_tools()

Quickstart (JavaScript)

npm i langchain-aproxpay @langchain/core
export APROXPROXY_PRIVATE_KEY=0x…
import { createAproxPayTools } from "langchain-aproxpay";

const { aproxpay_proxy_get } = createAproxPayTools();
const result = await aproxpay_proxy_get.invoke({
  url: "https://api.ipify.org?format=json",
});
console.log(result);

Environment

Variable Required Default Notes
APROXPROXY_PRIVATE_KEY yes (unless injecting a test transport) 0x + 64 hex. Use a dedicated low-balance buyer wallet funded with USDC on Base. Never commit or log this value.
APROXPROXY_BASE_URL no https://proxy.aproxpay.com Override for staging/local.

Tools

Tool Pays Purpose
aproxpay_proxy_get ~$0.003 Hero: fetch a URL via residential IP (2MB cap). Optional region, sticky, sticky_duration.
aproxpay_list_countries free ISO exit countries for region.
aproxpay_create_session tiered Ephemeral CONNECT credentials for Playwright / curl.
aproxpay_extend_session ~$0.15 +30 min / +50MB (not for gb tier).
aproxpay_close_session free Invalidate credentials (no refund).

Product A success responses are HTTP 200 with origin status in X-Target-Status — tools return that origin status, not the envelope 200.

Session pass (Playwright)

from langchain_aproxpay import AproxPayCreateSessionTool
import json

raw = AproxPayCreateSessionTool().invoke({"tier": "entry", "region": "us"})
session = json.loads(raw)
# Always use the https proxy URL — never plain http:// against gw:443
proxy_url = session["proxyUrl"]  # https://user:pass@gw.aproxpay.com:443

Production gateway is TLS on :443. Documented fallback: same credentials on :8443 (https://user:pass@gw.aproxpay.com:8443). Plain http:// to :443 hits the web front and returns 404.

Pricing

See aproxpay.com/pricing for the live ladder. Approximate MVP tiers:

Product Price Cap
Per-request (proxy_get) $0.003 2MB
Per-request large $0.015 5MB
Session entry $0.05 30 min + 15MB
Session heavy $0.50 60 min + 200MB
Session gb $2.50 ≤120 min + 1GB dedicated
Extend $0.15 +30 min + 50MB

Security

  • Keep the buyer private key on the machine that runs the agent (non-custodial).
  • Do not log APROXPROXY_PRIVATE_KEY, Authorization, or payment headers.
  • Close session early if you are done — there is no automatic refund.

Development

# JS
cd js && npm ci && npm test && npm run build

# Python
cd python && uv sync --group dev && uv run pytest && uv run ruff check src tests

License

MIT © AproxPay

Release files for langchain-aproxpay 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-aproxpay 0.1.0
File Size Uploaded
langchain_aproxpay-0.1.0.tar.gz 11.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-aproxpay 0.1.0
File Interpreter ABI Platform
langchain_aproxpay-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.6 kB

Release files / langchain_aproxpay-0.1.0.tar.gz

Download URL langchain_aproxpay-0.1.0.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
22abf47b6c7f627bd4e286d04b1a258f25c75051d2d7a9246c6322a2da952e00
BLAKE2b-256 checksum
How to use checksums
3bba0aef6cab7d2bb35eba8f5e861f248c89b06d8bd68541ed2a38894434e060
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release files / langchain_aproxpay-0.1.0-py3-none-any.whl

Download URL langchain_aproxpay-0.1.0-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac5c3a7abf01c2363279615e7a2dacf5ce7c4ab04bcf6b5d81b6cdff0eb4d0f3
BLAKE2b-256 checksum
How to use checksums
a0b194598f26b5b4855edfac0e07be226a8b4932d90ea09a4e3418f1341b041c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page