The answers Groq 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.
400Organization reached the monthly spend limit it set
Moves to the next key: your own spend limit
{
"error": {
"code": "blocked_api_access"
}
}
Documented by Groq: console.groq.com. The body shows the fields the source establishes.
401Invalid API key
Moves to the next key: key not accepted
Documented by Groq: console.groq.com
498Flex tier capacity exceeded
Stays with your SDK
A capacity decision, not a billing one.
Documented by Groq: console.groq.com
Give the pool a second key that bills another organization you are authorized to use. When Groq 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, GROQ } from "keyover"
const pool = createKeyPool({
provider: GROQ,
keys: {
primary: process.env.GROQ_API_KEY,
spare: process.env.GROQ_API_KEY_SPARE,
},
})
const client = new OpenAI({ ...pool.clientOptions, baseURL: "https://api.groq.com/openai/v1" })