budgets

Create spend alert or limit

type=alert sends a notification once per period when token cost reaches threshold_amount in the selected currency. type=limit holds new runs in the queue once spend reaches the threshold, until the next period or until the limit is raised, disabled or removed. scope is global (whole project), environment (environment IDs in scope_ids) or agent (agent names in scope_ids). period is monthly or daily.

Required permission: budgets.manage.

post/v1/projects/{project_id}/budgets/alerts

Request

  • Base URL
    https://api.connic.co
  • Auth
    HTTP bearer

Path parameters

project_id, string uuid required

ID of the project the API key belongs to.

Request body

SpendAlertCreate required
name, string required
type, 'alert' | 'limit' required

alert sends a notification when spend reaches the threshold. limit also keeps new runs queued until the period resets or the limit is raised, disabled or deleted.

threshold_amount, union required

Spend that triggers the rule, as a positive decimal string in currency.

currency, 'USD' | 'EUR'

Currency of the threshold. Only token costs priced in this currency count toward the spend.

scope, 'global' | 'environment' | 'agent'

global counts all project spend, environment only the environments in scope_ids, agent only the agents named in scope_ids.

scope_ids, string[] nullable

Environment IDs or agent names, depending on scope. Ignored for global.

period, 'monthly' | 'daily'

Spend window: the current calendar month or the current day, in UTC.

enabled, boolean

Whether the rule is evaluated.

Response

Successful Response

SpendAlertResponse required

A spend notification (alert) or hard cap (limit) for the project.

id, string uuid required
project_id, string uuid required

Project the rule belongs to.

name, string required
type, 'alert' | 'limit' required

alert sends a notification when spend reaches the threshold; limit also keeps new runs queued.

threshold_amount, string required

Spend that triggers the rule, as a decimal string in currency.

currency, 'USD' | 'EUR' required

Currency of the threshold and of current_spend.

scope, 'global' | 'environment' | 'agent' required

global counts all project spend, environment only the environments in scope_ids, agent only the agents named in scope_ids.

scope_ids, string[] nullable

Environment IDs or agent names, depending on scope.

period, 'monthly' | 'daily' required

Spend window: the current calendar month or the current day, in UTC.

enabled, boolean required

Whether the rule is evaluated.

last_triggered_at, string date-time nullable

When the rule last fired. It fires at most once per period.

created_at, string date-time required
updated_at, string date-time required
current_spend, string nullable

Spend so far in the current period, as a decimal string in currency. Null when some model calls could not be priced.

current_spend_coverage, object

Pricing coverage of current_spend: complete, call_count, priced_call_count, unpriced_call_count, unpriced_models and missing_price_models.

Changes

No recorded changes to this operation across all 17 revisions of this API.