API Reference

Micropay exposes an OpenAI-compatible surface with x402 payment headers. Clients pay USDC on Algorand; Micropay settles via the GoPlausible facilitator, then fulfills inference through its server-side provider gateway.

Realtime

  • SSE — chat token streaming (stream:true) and image job progress (GET …/jobs/:id?stream=1).
  • WebSocket — not used; HTTP SSE covers streaming.
  • JSON poll — optional fallback for image jobs without stream=1.
# Browser clients: use @x402/fetch + Algorand wallet (auto PAYMENT-SIGNATURE).
# Agents: handle 402 → sign → retry with PAYMENT-SIGNATURE.

curl http://localhost:3000/api/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "PAYMENT-SIGNATURE: <signed-payload>" \
  -d '{
    "model": "glm-5.2",
    "messages": [{"role":"user","content":"Hello"}]
  }'