Error reference

Fireworks AI billing and quota errors

The answers Fireworks AI gives when an organization cannot pay for a request, and the ones that look similar but are not about money. For each: the status, the body, and what keyover does with it.

Rejections about money or the key

402Account is not on a paid plan or has exceeded usage limits

Moves to the next key: out of credit

Documented by Fireworks AI: docs.fireworks.ai

Answers that are not a reason to change key

401Invalid API key or insufficient permissions

Stays with your SDK

One status for a bad key and for missing permissions. It passes.

Documented by Fireworks AI: docs.fireworks.ai

412Account is suspended

Stays with your SDK

A suspension, or a model that failed to load. Never routed around.

Documented by Fireworks AI: docs.fireworks.ai

Keep serving through it

Give the pool a second key that bills another organization you are authorized to use. When Fireworks AI refuses the first for one of the rejections above, the same request is sent again on the second, inside the same call. Your code gets a normal response, and an event tells you which organization needs attention.

import OpenAI from "openai"
import { createKeyPool, FIREWORKS } from "keyover"

const pool = createKeyPool({
  provider: FIREWORKS,
  keys: {
    primary: process.env.FIREWORKS_API_KEY,
    spare: process.env.FIREWORKS_API_KEY_SPARE,
  },
})

const client = new OpenAI({ ...pool.clientOptions, baseURL: "https://api.fireworks.ai/inference/v1" })

See it fail over in the playground, or read the README.