> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ruapi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# DeepSeek API error 402 “Insufficient Balance” — what it means and how to fix it

> The DeepSeek API error “402 Insufficient Balance” in your code, Cline, Cursor and other tools means your DeepSeek balance has run out. How to check the balance, how to top up, and what to do if you can't top up — connect the same DeepSeek models via RuAPI and pay in USDT.

**In short:** DeepSeek itself returns this error when the account behind the key has run out of money. Retrying won't help — you need to top up your DeepSeek balance. If you can't top up (your card is declined, PayPal isn't available), connect the same DeepSeek models via RuAPI: you swap the key and the address, and pay in USDT or with a card from a foreign bank.

## What the error looks like

A response with code **402** and `Insufficient Balance` in the body. For example, in Python (OpenAI SDK):

```text theme={null}
openai.APIStatusError: Error code: 402 - {'error': {'message': 'Insufficient Balance', 'type': 'unknown_error', 'param': None, 'code': 'invalid_request_error'}}
```

Cline, Roo Code, Claude Code and other tools usually show it shorter:

```text theme={null}
API Error: 402 Insufficient Balance
```

The `type` and `code` fields vary between versions — go by the **402** code and the `Insufficient Balance` text.

## Why it happens

* **The balance has run out.** DeepSeek's [error code list](https://api-docs.deepseek.com/quick_start/error_codes) says exactly that: 402 means there is no money left on the account; check the balance and top it up.
* **Granted credit has expired.** DeepSeek has granted (bonus) credit with an expiry date. When it expires and there is no money of your own on the account, you get the same error.
* **It's not only your code spending.** Every tool using the key — IDE agents, bots, scripts — draws from one balance. Coding agents with long context burn through it faster than you'd expect.

## How to check the balance

In your dashboard at [platform.deepseek.com](https://platform.deepseek.com) or with [GET /user/balance](https://api-docs.deepseek.com/api/get-user-balance):

```bash theme={null}
curl https://api.deepseek.com/user/balance \
  -H "Authorization: Bearer $DEEPSEEK_API_KEY"
```

`"is_available": false` means there isn't enough money for requests; `total_balance` shows what's left.

## What you can do

| Situation | What to do |
| - | - |
| You can pay DeepSeek | Top up on the [top-up page](https://platform.deepseek.com/top_up). According to the [DeepSeek FAQ](https://api-docs.deepseek.com/faq), PayPal, bank cards, Alipay and WeChat Pay are accepted |
| Your bank card is declined and PayPal isn't available in your region | Connect the same DeepSeek models via RuAPI — steps below. No DeepSeek account needed |
| A similar error came from RuAPI | RuAPI reports insufficient funds with code **403**, not 402 — see [Error codes](https://docs.ruapi.ai/en/errors.md) |

More on payment options: [How to pay for the DeepSeek API](https://docs.ruapi.ai/en/pay-deepseek-api-russia.md).

## How to connect DeepSeek via RuAPI

**1. Sign up**

Sign up at [www.ruapi.ai](https://www.ruapi.ai/?lng=en\&utm_source=docs\&utm_campaign=en-deepseek-402-insufficient-balance) — with email, Google or Yandex.

**2. Top up**

Console → **Wallet**: USDT or USDC (TRC20 / BEP20 / Polygon; USDT also on TON), from 5 USDT. No USDT yet? [Buy it with rubles via SBP (Faster Payments System)](https://docs.ruapi.ai/en/buy-usdt.md). Cards from foreign banks (Visa / Mastercard) are accepted too.

**3. Key**

Console → **API Keys** → **Create API key** — you'll get an `sk-...` string.

**4. Swap the key and address**

In your code or your tool's settings, set the address to `https://www.ruapi.ai/v1`, the key to your RuAPI key, and the model to `deepseek-flash` or `deepseek-v4-pro`.

```python OpenAI SDK theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="sk-your-RuAPI-key",
    base_url="https://www.ruapi.ai/v1",
)

resp = client.chat.completions.create(
    model="deepseek-flash",  # or deepseek-v4-pro
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
```

```bash curl theme={null}
curl https://www.ruapi.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-your-RuAPI-key" \
  -H "Content-Type: application/json" \
  -d '{"model": "deepseek-flash", "messages": [{"role": "user", "content": "Hello!"}]}'
```

How `deepseek-flash` and `deepseek-v4-pro` differ and which to pick: [DeepSeek API](https://docs.ruapi.ai/en/deepseek-api.md). Setting up Cline, Roo Code, Cursor and other tools: see the integrations section, for example [Cline](https://docs.ruapi.ai/en/integrations/cline.md).

## FAQ

> [accordion] Will a new DeepSeek key help?
>
> No. The balance belongs to the whole account; a new key draws from the same one. You need to top up or use another provider.

> [accordion] Should I retry the request?
>
> No. Until the balance is topped up, every retry returns the same 402. If your tool retries on its own, turn retries off for code 402.

> [accordion] Are these the same DeepSeek models?
>
> Yes. RuAPI serves DeepSeek models — `deepseek-flash` and `deepseek-v4-pro` — over the same OpenAI-compatible protocol.

> [accordion] Do I need a VPN?
>
> No. The RuAPI site and API work directly, no VPN required.

## Next steps

> [card] [DeepSeek API](https://docs.ruapi.ai/en/deepseek-api.md)
>
> Models, capabilities and setup.

> [card] [How to buy USDT with rubles](https://docs.ruapi.ai/en/buy-usdt.md)
>
> SBP, Sberbank, T-Bank — step by step.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.