Skip to content

armgit / sie

Public Imported from GitHub
0

Open-source inference server and production cluster for all the models your agent needs.

docs(sdk): say where the balance is and what the admission 503/429 mean (#951)

Krisztian Gajdarc8b23952349e
diff --git a/packages/sie_sdk/README.md b/packages/sie_sdk/README.md
index 648cd0429..64b17fee6 100644
--- a/packages/sie_sdk/README.md
+++ b/packages/sie_sdk/README.md
@@ -424,11 +424,17 @@ next section for the `RESOURCE_EXHAUSTED` budget):
`ResourceExhaustedError` when retries run out. Pass
`max_oom_retries=0` to disable these retries and fail fast.
-Admission rejections happen before any work is dispatched, so every call
-retries them within `provision_timeout_s`, honouring `Retry-After`:
-`429 RATE_LIMIT`, `503 QUEUE_FULL`, and the gateway's queue backpressure,
-a `503 QUEUE_UNAVAILABLE` that carries `Retry-After`. A
-`QUEUE_UNAVAILABLE` without `Retry-After` is terminal.
+Admission rejections happen before any work is dispatched, so every
+inference call retries them within `provision_timeout_s`, honouring
+`Retry-After` (`estimate()` raises them without retrying):
+`429 RATE_LIMIT`, `503 QUEUE_FULL`, `503 BILLING_CAPACITY_UNAVAILABLE`,
+and the gateway's queue backpressure, a `503 QUEUE_UNAVAILABLE` that
+carries `Retry-After`. A `QUEUE_UNAVAILABLE` without `Retry-After` is
+terminal. On SIE Cloud, `429 RATE_LIMIT` means the API key or its account
+has reached its limit on requests in flight or per second, and
+`503 BILLING_CAPACITY_UNAVAILABLE` means the gateway could not reserve
+billing capacity for the request in time. Neither means the credit
+balance ran out, and neither is billed.
[`packages/wire-fixtures/retry_classification.json`](../wire-fixtures/retry_classification.json)
lists how each response is classified; the Python and TypeScript SDKs
both test against it.
diff --git a/packages/sie_sdk/src/sie_sdk/types.py b/packages/sie_sdk/src/sie_sdk/types.py
index 1d48abe95..ac0c91c74 100644
--- a/packages/sie_sdk/src/sie_sdk/types.py
+++ b/packages/sie_sdk/src/sie_sdk/types.py
@@ -731,8 +731,8 @@ class GenerationUsage(TypedDict):
``stream_options.include_usage`` — without that there is no usage chunk at
all. Native generate always carries usage on its terminal chunk. A stream
whose terminal settle did not commit in time reports its tokens without a
- charge rather than guessing one; ``GET /me/usage`` remains the balance
- authority.
+ charge rather than guessing one. The account balance is not readable with
+ an API key; the console shows it.
"""
prompt_tokens: int
diff --git a/packages/sie_ts_sdk/README.md b/packages/sie_ts_sdk/README.md
index 346ab773b..49d2ea79e 100644
--- a/packages/sie_ts_sdk/README.md
+++ b/packages/sie_ts_sdk/README.md
@@ -234,11 +234,17 @@ Retry semantics for transient `503` codes:
exponential backoff; throws `ResourceExhaustedError` (a `ServerError`
subclass) when retries run out.
-Admission rejections happen before any work is dispatched, so every call
-retries them within `provisionTimeout`, honouring `Retry-After` (delay
-seconds or an HTTP date): `429 RATE_LIMIT`, `503 QUEUE_FULL`, and the
-gateway's queue backpressure, a `503 QUEUE_UNAVAILABLE` that carries
-`Retry-After`. A `QUEUE_UNAVAILABLE` without `Retry-After` is terminal.
+Admission rejections happen before any work is dispatched, so every
+inference call retries them within `provisionTimeout`, honouring
+`Retry-After` (delay seconds or an HTTP date; `estimate()` throws them
+without retrying): `429 RATE_LIMIT`, `503 QUEUE_FULL`,
+`503 BILLING_CAPACITY_UNAVAILABLE`, and the gateway's queue backpressure, a
+`503 QUEUE_UNAVAILABLE` that carries `Retry-After`. A `QUEUE_UNAVAILABLE`
+without `Retry-After` is terminal. On SIE Cloud, `429 RATE_LIMIT` means the
+API key or its account has reached its limit on requests in flight or per
+second, and `503 BILLING_CAPACITY_UNAVAILABLE` means the gateway could not
+reserve billing capacity for the request in time. Neither means the credit
+balance ran out, and neither is billed.
[`packages/wire-fixtures/retry_classification.json`](../wire-fixtures/retry_classification.json)
lists how each response is classified; the TypeScript and Python SDKs
both test against it.
diff --git a/packages/sie_ts_sdk/src/types.ts b/packages/sie_ts_sdk/src/types.ts
index e41e8998d..88fdfff09 100644
--- a/packages/sie_ts_sdk/src/types.ts
+++ b/packages/sie_ts_sdk/src/types.ts
@@ -1477,8 +1477,8 @@ export interface ChatCompletionRequest {
* stream there is no header to fall back to: without
* `stream_options.include_usage` there is no usage chunk at all, and a stream
* whose terminal settle did not commit in time reports its tokens without a
- * charge rather than guessing one. `GET /me/usage` remains the balance
- * authority.
+ * charge rather than guessing one. The account balance is not readable with
+ * an API key; the console shows it.
*/
export interface ChatUsage {
prompt_tokens: number;