jcode icon indicating copy to clipboard operation
jcode copied to clipboard

OpenAI-compatible 402 billing error shows a network connectivity hint

Open SiavZ opened this issue 2 months ago • 0 comments

What happens

An OpenAI-compatible provider answers 402 Payment Required with a body like:

{"error":{"message":"API key token allowance exhausted...","type":"insufficient_balance_error","code":"api_key_token_limit_exceeded"}}

jcode reports the error and ends it with "Hint: check network connectivity, DNS/TLS, ...". That is wrong. The network works (the server replied), the key hit a billing limit.

Steps to reproduce

  1. Configure an OpenAI-compatible provider with a key whose token allowance or balance is used up.
  2. Send any prompt.
  3. Read the error: the hint points at network connectivity and DNS/TLS.

Expected

A 402 hint that names the billing limit and suggests topping up, using another key, or switching provider with /model. 401/403 should point at the key, not the network.

SiavZ avatar Sep 29 '26 13:09 SiavZ