gate402
Python client for Gate402 — pay-per-call APIs for AI agents over x402 (USDC on Base). Open-model LLM inference, crypto/finance data, web tools, and $1 file/document utilities. No signup: a free-tier key is auto-claimed on first use.
pip install gate402
Quick start
from gate402 import Gate402
g = Gate402() # free-tier key auto-claimed on first call (or set GATE402_API_KEY)
print(g.infer(prompt="Say hello in five words.")["text"])
print(g.onchain("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"))
print(g.json_repair('{"name": "Bob", "age": 32,}'))
print(g.heic_to_jpg(file="IMG_1234.HEIC"))
Methods
Live catalog: gate402.app/v1
| Method | Endpoint | What it does |
|---|---|---|
infer(prompt=…, model=…) |
/v1/infer |
Per-token LLM inference (Llama 3.1 / Qwen / Mistral) |
compute(image, gpu, duration_sec) |
/v1/compute |
Rent metered GPU/CPU per second (503 unless a worker is wired) |
onchain(address) |
/v1/onchain |
Wallet/token intel on Base |
dex(address) |
/v1/dex |
Live DEX price / liquidity / volume |
token_risk(address) |
/v1/token-risk |
Rug/tradeability verdict + honeypot sim |
momentum(address) |
/v1/momentum |
Momentum + order-flow signal |
best_swap(address, size_usd=…) |
/v1/best-swap |
Best pool + price impact for a trade size |
launches() |
/v1/launches |
Freshest Base token launches |
demand(limit=…) |
/v1/demand |
Anonymized agent demand intel (unmatched paths, conversion by tool) |
news(query) / edgar(ticker=…) |
/v1/news, /v1/edgar |
News+sentiment / SEC filings |
scrape(url, stealth=False) |
/v1/proxy |
Fetch a page as clean Markdown |
minify(text) / dedup(query) |
/v1/minify, /v1/dedup |
Token compression / semantic cache |
json_repair(text) |
/v1/json-repair |
Repair malformed / LLM-mangled JSON |
csv_json(text, direction=…) |
/v1/csv-json |
CSV ↔ JSON |
contract_scan(address) |
/v1/contract-scan |
Full contract risk scorecard |
abi_decode(data, address=…) |
/v1/abi-decode |
Decode calldata / ABI |
site_screenshot(url) |
/v1/site-screenshot |
Desktop/mobile screenshot of a URL |
invoice_pro(text=…) |
/v1/invoice-pro |
Notes or screenshot → invoice PDF |
crypto_tax_csv(text=…) |
/v1/crypto-tax-csv |
Normalize exchange CSV for tax software |
uploadfix(file=…) |
/v1/uploadfix |
Fix a rejected upload (HEIC, size, pixels) |
heic_to_jpg(file=…) |
/v1/heic-to-jpg |
HEIC/HEIF → JPG |
under_mb(file=…, max_mb=5) |
/v1/under-mb |
Shrink a file under a max size |
image_fit(width, height, file=…) |
/v1/image-fit |
Resize an image to exact pixels |
metadata_strip(file=…) |
/v1/metadata-strip |
Strip EXIF/GPS |
photo_to_pdf(file=…) |
/v1/photo-to-pdf |
Photos of pages → PDF |
bg_remove(file=…) |
/v1/bg-remove |
Background removal → PNG |
video_under_mb(file=…) |
/v1/video-under-mb |
Compress a video under a max size |
ocr_structured(file=…) |
/v1/ocr-structured |
OCR a receipt/ID/form → JSON |
ats_resume(job_description, file=…) |
/v1/ats-resume |
ATS score + rewritten resume PDF |
pdf_fillable(file=…) |
/v1/pdf-fillable |
Flat PDF → fillable AcroForm |
pdf_a11y(file=…) |
/v1/pdf-a11y |
PDF accessibility tagging |
doc_checker(file=…) |
/v1/doc-checker |
Pass/fail against upload rules |
call("/v1/…", body) |
any | POST an arbitrary catalog route |
catalog() |
/v1 |
Free. Machine-readable endpoint catalog |
providers() |
/v1/providers |
Free. Browse the GPU marketplace supply |
market_infer(model, prompt=…) |
/v1/market/infer |
Marketplace inference — x402-native (see below) |
File methods accept a local path or bytes (file=) or file_base64= + filename=.
Billing
The payment is the auth — there are no accounts to create. On first use the client
self-claims a free-credit key from Gate402 and reuses it. When credit runs out,
calls raise Gate402PaymentRequired with a top-up link. Pass api_key=… or set
GATE402_API_KEY to use a funded account.
from gate402 import Gate402, Gate402PaymentRequired
try:
g.infer(prompt="…")
except Gate402PaymentRequired as e:
print(e) # → top-up link
GPU marketplace
providers() lists third-party GPU/compute supply (free). The buyer endpoint
market_infer() is x402-native — it settles on-chain per call with
escrow-on-success, so the free-tier / API-key rail cannot pay it and it raises
Gate402PaymentRequired. Use an x402 payment client to call POST /v1/market/infer
directly. To sell your GPU, register at POST /v1/providers/register.
Configuration
| Env var | Default | Purpose |
|---|---|---|
GATE402_API_KEY |
(auto free tier) | A funded account key to skip the free tier |
GATE402_BASE_URL |
https://gate402.app |
Override the gateway base URL |
MIT licensed.
Metadata
Release files for gate402 0.2.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 |
|---|---|---|---|---|
| gate402-0.2.1.tar.gz | 9.1 kB | Without provenance | Details for gate402-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gate402-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for gate402-0.2.1-py3-none-any.whl |
Total release size: 19.4 kB
Release files / gate402-0.2.1.tar.gz
| Download URL | gate402-0.2.1.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ef3e074e51dbe19f4179950100ce6c55119a0fdaf37d164531eb7fd16f7b7cb
|
|
BLAKE2b-256 checksum How to use checksums |
653c07d58819f2bf083932a5a8030eaeec3ecb4453141c5e883a2cdfd85b6a15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / gate402-0.2.1-py3-none-any.whl
| Download URL | gate402-0.2.1-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
325d9278130e6b9d0e248af39c8fd56329a354d5c424ea3f8229c604963b7e11
|
|
BLAKE2b-256 checksum How to use checksums |
fa07170743e94fe3ceb4b1b272b033a663e7785f3492c5b9ac4941c9a03975d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Security for gate402 0.2.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.