402 runbook
HTTP 402 alone is not enough. OfflineCreator uses two shapes: a legacy insufficient-credits JSON body without PAYMENT-REQUIRED, and an x402 challenge that includes the PAYMENT-REQUIRED header with machine-payable USDC terms.
Follow the sequence in order. Each step is a bounded operator action—not a promise that every deployment has x402 enabled.
Preserve HTTP 402, the JSON code/body, and whether PAYMENT-REQUIRED is present. Do not retry paid work until that envelope is recorded.
If there is no PAYMENT-REQUIRED header, treat it as a human funding signal. Top up via Studio pricing or Stripe Checkout, then re-read balance.
If PAYMENT-REQUIRED is present, the body carries payment terms and usually a locked quote. A configured stdio MCP or CLI wallet can sign and retry with PAYMENT-SIGNATURE.
After settlement or human purchase, run balance (or get_credits) again. Retry only when the operator chooses to continue.
x402 is payment, not login. Bearer or OAuth auth still runs before any challenge.
JSON INSUFFICIENT_CREDITS without PAYMENT-REQUIRED means fund the account in a browser.
PAYMENT-REQUIRED means sign USDC locally under the session spend cap.
No. Both rails can return 402. The PAYMENT-REQUIRED header is the reliable branch: present means x402 challenge; absent with INSUFFICIENT_CREDITS means human Stripe or Studio top-up.
The API keeps the classic JSON insufficient-credits 402. Configure Stripe or Studio top-up, or enable the rail on the server before expecting wallet settlement.
Humans stay on Stripe. Agents settle only with a local wallet and a spend cap. When the shape is unclear, start with the PAYMENT-REQUIRED diagnosis runbook.