Set End User AI Quota Limit

Sets a periodic AI credit limit for an End User. The limit rule is stored in Redis;
actual consumption is sourced from ss_ai_message. After saving the rule, the endpoint
immediately aggregates the database consumption within the new period and returns the
quota status.

Semantics:

  • The period is a left-closed, right-open interval [startTime, endTime), i.e.
    message_time >= startTime AND message_time < endTime.
  • maximumLimitCredits must be a JSON integer >= 0. Decimals and strings are rejected.
    When it is 0, the End User is not allowed to use AI regardless of historical usage.
  • One End User keeps only one active rule. A subsequent PUT overwrites the previous rule
    and recomputes usage against the new period.
  • The rule is scoped by applicationId + endUserId and is independent of login tokens;
    multiple sessions share the same rule and the same aggregated consumption.
  • usedCredits is ROUND(SUM(ss_ai_message.total_credits)) within the period. All quota
    fields are integers.

Enforcement:

  • The End User quota enforcement is gated by the AI_END_USER_QUOTA capability. When the
    capability is not enabled, AI calls only check the Application shared pool and the
    End User quota rule is ignored.
  • When enforcement is enabled, the quota rule is checked on every AI call. A missing,
    not-yet-started, expired, or used-up rule blocks the AI call and returns the
    corresponding endUserAiQuota* error below. Account users are not affected by End
    User quota and never receive these errors.
  • The endUserAiQuota* errors are returned only when an AI call is made under an
    End User token after enforcement is enabled; the PUT endpoint itself does not return
    them for rule validation failures (those return invalidParameter or
    aiQuotaEvaluationFailed).
Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params
string
required
length ≤ 255

Caller-provided End User ID. Same rule as /access/code.

int64
required
≥ 0

AI credit ceiling for the period. Must be a JSON integer >= 0. Decimals and strings
are rejected. When it is 0, the End User is not allowed to use AI regardless of
historical usage.

date-time
required

Period start time, inclusive, in ISO 8601 with timezone.

date-time
required

Period end time, exclusive, in ISO 8601 with timezone. Must be later than startTime.

Responses

Language
Credentials
Bearer
opaque
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json