Credits
Check your team's remaining OpenGateway balance, model-specific credits, and the calling API key's spending limits with GET /v1/credits.
GET https://apis.opengateway.ai/v1/credits returns the balance of the team that owns the API key, its model-specific credits, and the key's own status and spending limits. Use it to check your balance from scripts, CI, or agents without opening the console.
The call is free: it is not billed and does not appear in usage or logs.
Endpoint and authentication#
| Item | Value |
|---|---|
| Method and path | GET https://apis.opengateway.ai/v1/credits |
| Authentication | Required: Authorization: Bearer <key>, or x-api-key: <key> when no Authorization header is sent |
| Request body | None |
A key suspended because the team ran out of balance still gets 200 here, so you can confirm the balance is zero. A disabled, deleted, or unknown key gets the usual 401 invalid_api_key.
curl https://apis.opengateway.ai/v1/credits \-H "Authorization: Bearer $OPENGATEWAY_API_KEY"
Response#
{"object": "credits","currency": "USD","balance": 12.34,"credit_limit": 0.0,"available_balance": 12.34,"model_credits": [{"models": ["deepseek/*"],"remaining": 5.0,"expires_at": "2026-12-31T00:00:00Z"}],"key": {"status": "active","suspension_reason": null,"spending_limit": {"enforcement": "hard","daily": null,"weekly": null,"monthly": {"limit": 50.0,"spent": 10.2,"remaining": 39.8,"resets_at": "2026-12-01T00:00:00Z"},"as_of": "2026-11-12T04:10:00Z"}}}
All amounts are USD, rounded half-up to 6 decimal places. Fields without data are null, never omitted.
| Field | Type | Meaning |
|---|---|---|
object | string | Always credits. |
currency | string | Always USD. |
balance | number | General balance, usable for any model. Negative while a postpaid credit line is in use. |
credit_limit | number | Postpaid credit line. 0 for prepaid teams. |
available_balance | number | balance + credit_limit: what can still be spent on any model. |
model_credits | array | Unexpired model-specific credits, soonest expiry first, which is the order usage consumes them. Empty when there are none. |
model_credits[].models | string[] | Models the credit pays for: creator/model IDs, or creator/* for every model of a creator. |
model_credits[].remaining | number | Unused amount. |
model_credits[].expires_at | string | Expiry time (ISO 8601, UTC). |
key.status | string | active, or suspended when the team ran out of balance. |
key.suspension_reason | string or null | insufficient_balance while suspended, otherwise null. |
key.spending_limit | object or null | The key's spending limits from the Quota page. null when the key has none. |
key.spending_limit.enforcement | string | hard: requests get 429 budget_exceeded at 100%. soft: requests continue and carry an X-OG-Budget-Warn header. none: not enforced. |
key.spending_limit.daily, .weekly, .monthly | object or null | One limit window, or null when that window has no limit. Windows are UTC: the calendar day, the week starting Monday, and the calendar month. |
...limit | number | Limit for the window. |
...spent | number | Spend counted against the limit in the current window. |
...remaining | number | limit - spent, never below 0. |
...resets_at | string | Start of the next window (ISO 8601, UTC). |
key.spending_limit.as_of | string | When spent was computed. Spend can trail live usage slightly (normally under a minute); this timestamp shows by how much. |
The response never includes team IDs, key IDs, or key secrets. A key only ever sees its own team.
The team-wide monthly limit on the Quota page is not part of this response; see it in the console.
Errors#
| Status | Code | When |
|---|---|---|
401 | invalid_api_key | Missing, unknown, disabled, or deleted key. |
403 | apikey_suspended | The key is suspended by a guardrail policy. |
503 | service_unavailable | The balance could not be read right now. Retry after the Retry-After seconds. |
Balance and model credits are cached for up to 5 seconds per key, so polling faster than that returns the same numbers.