Saltar al contenido principal
PUT
/
api
/
v1
/
llm
/
budgets
/
apikey
/
{apiKeyId}
Python (SDK)
from meetkai_mka1 import SDK


with SDK(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:

    res = sdk.llm.budgets.set_api_key(api_key_id="<id>", period="weekly", limit_kind="tokens", limit=3281.35, thresholds=[
        {
            "pct": 793338,
            "action": "alert",
        },
    ])

    # Handle response
    print(res)
{
  "id": "<string>",
  "scope_id": "<string>",
  "limit": 123,
  "thresholds": [
    {
      "pct": 50
    }
  ],
  "alert_webhook_url": "<string>",
  "spend": {
    "window": "<string>",
    "cost_spent_nano": "<string>",
    "cost_spent": 123,
    "tokens_spent": "<string>",
    "pct": 123
  }
}

Autorizaciones

Authorization
string
header
requerido

Gateway auth: send Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, you can also send X-On-Behalf-Of: <external-user-id>.

Parámetros de ruta

apiKeyId
string
requerido
Minimum string length: 1

Cuerpo

application/json
period
enum<string>
requerido
Opciones disponibles:
daily,
weekly,
monthly
limit_kind
enum<string>
requerido
Opciones disponibles:
cost,
tokens
limit
number
requerido

Límite en unidades principales: monto en moneda para el costo, conteo de tokens para los tokens

thresholds
object[]
requerido
Minimum array length: 1
owner
enum<string>
predeterminado:org

clúster = operador de techo (lectura única de org-admin); org = auto-presupuesto

Opciones disponibles:
cluster,
org
webhook_url
string<uri> | null
webhook_secret
string | null
Minimum string length: 1

Respuesta

200 - application/json

Está bien

id
string
requerido
scope
enum<string>
requerido
Opciones disponibles:
org,
apikey
scope_id
string
requerido
owner
enum<string>
requerido
Opciones disponibles:
cluster,
org
period
enum<string>
requerido
Opciones disponibles:
daily,
weekly,
monthly
limit_kind
enum<string>
requerido
Opciones disponibles:
cost,
tokens
limit
number
requerido
thresholds
object[]
requerido
alert_webhook_url
string | null
requerido
spend
object
requerido