Keep your existing OpenAI client. Change one line — the base URL — and pay per request in USDC instead of holding an API key.
Most LLM APIs make an agent stop and provision an account: sign up, verify email,
create a key, add a card, mind a monthly bill. For an autonomous agent that is friction
it cannot clear on its own. scrape402 exposes a standard
POST /v1/chat/completions endpoint that speaks the OpenAI request and
response shape, so your existing SDK works unchanged — but instead of an API key, the
agent pays a few tenths of a cent per call in USDC over the
x402 protocol on Base.
from openai import OpenAI
client = OpenAI(base_url="https://x402.shizu.me/v1", api_key="not-needed")
# unpaid calls return HTTP 402 with USDC payment requirements; an x402
# client (x402-fetch on npm, x402 on PyPI) signs + retries automatically.
r = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "hello"}])
print(r.choices[0].message.content)
You get one free call, no wallet required, so you can confirm it works first:
curl -X POST https://x402.shizu.me/v1/free \
-H "Content-Type: application/json" \
-d '{"messages":[{"role":"user","content":"say hi"}]}'
The model field is honored: names like gpt-4o-mini or
gpt-3.5-turbo route to a fast, cheap tier; gpt-4o to a larger
one. Flat, predictable pricing per call — no token math, no minimums, no subscription.
The same account-less gateway also serves /v1/embeddings and
/v1/models.