NylorunDocsBeta
Management APIModelsUsage and budgets

Set the Tenant's model budgets

PUT
/v1/tenant/budgets

Replaces every budget. Before each model call the gate checks the scope's spend against its cap; once a cap is reached the call fails with budget_exhausted and the turn with model.budget_exhausted. An empty list removes every cap.

Authorization

managementKey
headerAuthorizationBearer <token>

A management key of the Tenant (role management): it reaches the Management API (/v1/tenant/*) and /v1/me, as itself, never for a subject. Issued only on the Tenant's machine (nylorun-operate keys put <id> --role management) or from NYLORUN_MANAGEMENT_KEY_FILE. Never accepted from a browser (Origin).

Header Parameters

Nylorun-Protocol*string

The protocol version, 8

Request Body

application/json
  1. body
requestId?string
Length1 <= length
budgets*array<>
Itemsitems <= 100

Response Body

The budgets now in force

application/json
  1. response
budgets*array<>
import { createAdmin } from "@nylorun/admin";const admin = createAdmin();await admin.models.budgets.put({  budgets: [{ scope: "tenant", period: "month", limitUsd: 500 }],});
{  "budgets": [    {      "scope": "tenant",      "id": "string",      "period": "day",      "limitUsd": 1,      "limitTokens": 1    }  ]}