402Payment required: no active subscription or balance
Moves to the next key: out of credit
Documented by Cerebras: inference-docs.cerebras.ai
The answers Cerebras 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.
402Payment required: no active subscription or balanceMoves to the next key: out of credit
Documented by Cerebras: inference-docs.cerebras.ai
429Too many requestsStays with your SDK
A traffic control. Your SDK retries it.
Documented by Cerebras: inference-docs.cerebras.ai
Give the pool a second key that bills another organization you are authorized to use. When Cerebras 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, CEREBRAS } from "keyover"
const pool = createKeyPool({
provider: CEREBRAS,
keys: {
primary: process.env.CEREBRAS_API_KEY,
spare: process.env.CEREBRAS_API_KEY_SPARE,
},
})
const client = new OpenAI({ ...pool.clientOptions, baseURL: "https://api.cerebras.ai/v1" })See it fail over in the playground, or read the README.