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
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.
402Account is not on a paid plan or has exceeded usage limitsMoves to the next key: out of credit
Documented by Fireworks AI: docs.fireworks.ai
401Invalid API key or insufficient permissionsStays with your SDK
One status for a bad key and for missing permissions. It passes.
Documented by Fireworks AI: docs.fireworks.ai
412Account is suspendedStays with your SDK
A suspension, or a model that failed to load. Never routed around.
Documented by Fireworks AI: docs.fireworks.ai
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.