AiAttributionQuotaPut ai.attribution-quota-put@1

Generated at from openvibe-contracts v0.76.0 and openvibe-sdk v0.20.1.

Version
1.0.0
Owner
ai
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/ai/attribution-quota-put.v1.json

ai.attribution-quota-put@1 (OpenVibe.AI; roadmap WS-O task 2): a cap on runs attributed to one of the caller's own entities, PUT /api/v1/attribution-quotas/{attribution} with capability ai.quota.attribution.manage; the attribution's service must be the caller (Live caps live:user:<id>, a streamer's AI viewers). Over the cap a run is refused 429 quota.exceeded before any provider is called. Cost counts what runs have cost so far in the window, so the run that crosses the cap finishes and the next is refused.

Fields

FieldTypeRequiredDescriptionConstraints
windowenumyes
  • one of "hour", "day"
max_cost_usdnumber
  • minimum 0
  • maximum 10000
max_requestsinteger
  • minimum 0
  • maximum 1000000
workflow_prefixstringOnly runs of workflows whose key starts with this (live.viewers.).
  • pattern ^[a-z][a-z0-9_.-]{1,79}$

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: viewers-day
{
  "window": "day",
  "max_cost_usd": 0.2,
  "workflow_prefix": "live.viewers."
}
Rejected: minute
{
  "window": "minute",
  "max_requests": 5
}
Rejected: no-limit
{
  "window": "day"
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('ai.attribution-quota-put@1', value);   // { valid, errors: [{ path, message }] }