Skip to main content
PATCH
Update project spend limit
This endpoint requires an Admin Key with the org:write scope, and the key owner must still be an organization admin at call time (otherwise 403 owner_not_admin).Sending neither field (empty body {}) returns 400 invalid_request; provide at least one field.

Tri-state fields and period rules

  • Omitted field: keeps the current value for that period; null: clears that period’s budget (back to unlimited); a number: sets that period’s budget.
  • Daily and monthly periods are configured independently and do not affect each other; the response returns the complete configuration for both periods.
  • Budget semantics match “Get project spend limit”: daily resets at Asia/Shanghai day boundaries and monthly at month boundaries; exceeding the budget does not block API calls and usage beyond the budget is still billed (budgets are for spend management and usage-ratio display, not a hard stop).

Authorizations

Authorization
string
header
required

Send the Admin API secret as a Bearer token in the Authorization header (Bearer sk-admin-***). Create Admin Keys under Console → Organization → Admin API Keys.

Path Parameters

pid
string
required

Project ID.

Body

application/json

At least one field must be present.

daily_consume_limit
integer<uint64> | null

Daily spend limit (milli-cent). Omit to keep the current value, null to clear the limit (unlimited), or a number to set it.

Required range: x >= 0
monthly_consume_limit
integer<uint64> | null

Monthly spend limit (milli-cent). Omit to keep the current value, null to clear the limit (unlimited), or a number to set it.

Required range: x >= 0

Response

Updated spend limit.

daily_consume_limit
integer<uint64> | null
required

Daily consume limit (milli-cent). Accumulates and resets at Asia/Shanghai day boundaries; exceeding the budget does not block API calls and usage beyond it is still billed (spend management and usage-ratio display, not a hard stop). Null means not configured (unlimited); 0 means a zero budget (over-budget display only).

Required range: x >= 0
monthly_consume_limit
integer<uint64> | null
required

Monthly consume limit (milli-cent). Accumulates and resets at Asia/Shanghai month boundaries; exceeding the budget does not block API calls and usage beyond it is still billed (spend management and usage-ratio display, not a hard stop). Null means not configured (unlimited); 0 means a zero budget (over-budget display only).

Required range: x >= 0