Skip to main content
POST
/
v2
/
budgets
/
check
Check budget enforcement
curl --request POST \
  --url https://api.orq.ai/v2/budgets/check \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "workspace_id": "<string>",
  "api_key_id": "<string>",
  "project_id": "<string>",
  "identity_external_id": "<string>",
  "provider": "<string>",
  "model_id": "<string>"
}
'
{
  "allowed": true,
  "rejection": {
    "scope_kind": "<string>",
    "scope_target_id": "<string>",
    "dimension": "<string>",
    "code": "<string>",
    "message": "<string>"
  },
  "cost": {
    "limit": 123,
    "remaining": 123,
    "reset_seconds": 123
  },
  "tokens": {
    "limit": 123,
    "remaining": 123,
    "reset_seconds": 123
  },
  "requests": {
    "limit": 123,
    "remaining": 123,
    "reset_seconds": 123
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
workspace_id
string

Workspace the request belongs to.

api_key_id
string

API key that issued the request (if any).

project_id
string

Project the request targets (if any).

identity_external_id
string

Identity external id for contact-scoped budgets (if any).

provider
string

Provider enum value for provider-scoped budgets (if any).

model_id
string

Literal provider model_id for model-scoped budgets (if any).

Response

200 - application/json

OK

allowed
boolean

True when no applicable budget exceeds its limit.

rejection
object

Populated when allowed is false; identifies which budget and dimension triggered the rejection.

cost
object

Cost dimension info for rate-limit headers (nil when no cost budget applies).

tokens
object

Token dimension info for rate-limit headers (nil when no token budget applies).

requests
object

Requests dimension info for rate-limit headers (nil when no RPM budget applies).