Error reference

DeepSeek billing and quota errors

The answers DeepSeek 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

402Insufficient Balance

Moves to the next key: out of credit

Documented by DeepSeek: api-docs.deepseek.com

401Authentication fails: wrong API key

Moves to the next key: key not accepted

Documented by DeepSeek: api-docs.deepseek.com

Answers that are not a reason to change key

429Rate limit reached

Stays with your SDK

A traffic control. Your SDK retries it.

Documented by DeepSeek: api-docs.deepseek.com

Keep serving through it

Give the pool a second key that bills another organization you are authorized to use. When DeepSeek 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, DEEPSEEK } from "keyover"

const pool = createKeyPool({
  provider: DEEPSEEK,
  keys: {
    primary: process.env.DEEPSEEK_API_KEY,
    spare: process.env.DEEPSEEK_API_KEY_SPARE,
  },
})

const client = new OpenAI({ ...pool.clientOptions, baseURL: "https://api.deepseek.com" })

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