Skip to main content
POST
/
v2
/
budgets
cURL
curl --request POST \
  --url https://api.orq.ai/v2/budgets \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "scope": {
    "workspace": {},
    "project": {
      "project_id": "<string>"
    },
    "identity": {
      "identity_external_id": "<string>"
    },
    "api_key": {
      "api_key_id": "<string>"
    },
    "provider": {
      "provider": "<string>"
    },
    "model": {
      "model_id": "<string>"
    }
  },
  "limits": {
    "amount": 123,
    "token_limit": "<string>"
  },
  "rate_limit": {
    "requests_per_minute": 123
  },
  "is_active": true,
  "expires_at": "2023-11-07T05:31:56Z"
}
'
{
  "budget": {
    "budget_id": "<string>",
    "workspace_id": "<string>",
    "scope": {
      "workspace": {},
      "project": {
        "project_id": "<string>"
      },
      "identity": {
        "identity_external_id": "<string>"
      },
      "api_key": {
        "api_key_id": "<string>"
      },
      "provider": {
        "provider": "<string>"
      },
      "model": {
        "model_id": "<string>"
      }
    },
    "limits": {
      "amount": 123,
      "token_limit": "<string>"
    },
    "rate_limit": {
      "requests_per_minute": 123
    },
    "is_active": true,
    "expires_at": "2023-11-07T05:31:56Z",
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z"
  }
}

Authorizations

Authorization
string
header
required

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

Body

application/json
scope
object

Exactly one variant must be set.

limits
object

At least one of amount / token_limit / rate_limit.requests_per_minute must be provided on the budget; the handler enforces that invariant.

rate_limit
object

Optional rate limit.

is_active
boolean

Whether the budget should be active immediately. Defaults to true when omitted (handler enforces).

expires_at
string<date-time>

Optional expiration. When set in combination with is_active=true, the value MUST be in the future; the handler rejects past values.

Response

200 - application/json

OK

budget
object

Newly created budget.