Get top-ups and spending
Read the workspace’s cumulative top-ups and actual spending.
Last updated on
GET /v1/credits
Read cumulative workspace top-ups and actual spending.
Authentication
Authorization: Bearer <MANAGEMENT_API_KEY>: a management key bound to the workspace.
The credential determines the workspace. X-Org-Id is unsupported.
Parameters
No request body or parameters are required.
Response · 200
| Field | Type | Description |
|---|---|---|
data.total_credits | number | Total payment and manual top-ups over the workspace’s lifetime. |
data.total_usage | number | Total charges for requests and paid guardrail checks over the workspace’s lifetime. |
Amounts are in RUB. This response does not include currency or exact decimal strings. Read GET /v1/balance with an inference key for the available balance after reservations. Subtracting total_usage from total_credits does not account for reservations, refunds or other balance adjustments.
Response example
Identifiers and amounts in these examples are illustrative.
Request example
Load the key into a server environment variable. TypeScript uses Node.js fetch; Python uses only the standard library.
const response = await fetch("https://api.provod.ai/v1/credits", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.MANAGEMENT_API_KEY}`,
},
});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
console.log(await response.json());Errors
| HTTP | Error | Cause |
|---|---|---|
401 | Unauthorized | Missing, invalid, disabled, revoked or expired key. The X-Org-Id header is also rejected. |
403 | Forbidden | Wrong key kind or insufficient workspace access. |
Authentication error example:
{
"error": {
"code": "invalid_api_key",
"message": "Invalid API key",
"metadata": {}
}
}