ospalabs
Guide · Errors

Handle an API spending limit (HTTP 402) gracefully

Updated October 2026

When a request would cross a ceiling, Fuse answers 402 instead of forwarding it. The provider is not called and nothing is charged. Your app decides what happens next.

  1. 01

    Read the body

    The JSON body says which period was hit, how much is spent, the limit, the money held by requests in flight, and when the period resets. scope is project or key.

    402 response
    {
      "error": "fuse_blown",
      "scope": "project",
      "spent_usd": 24.97,
      "limit_usd": 25,
      "in_flight_usd": 0.01,
      "request_estimate_usd": 0.04,
      "period": "daily",
      "period_resets_at": "2026-11-23T00:00:00.000Z",
      "request_id": "req_…"
    }
  2. 02

    Pick a fallback

    Common choices: show a friendly message, queue the job until period_resets_at, or fall back to a cheaper model on another project with budget left.

  3. 03

    Do not retry blindly

    A 402 will repeat until the period resets or the ceiling is raised. Exponential backoff on 402 just delays the same answer.

  4. 04

    Line it up in the dashboard

    Every response carries x-fuse-request-id. Search for it in the request log to see the reservation and why it was refused.

Questions

Is 402 used for anything else?
Yes. A project beyond the one the free Hobby plan covers gets error subscription_inactive. Check the error field, not only the status.