Pular para o conteúdo 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
  }
}

Autorizações

Authorization
string
header
obrigatório

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 caminho

apiKeyId
string
obrigatório
Minimum string length: 1

Corpo

application/json
period
enum<string>
obrigatório
Opções disponíveis:
daily,
weekly,
monthly
limit_kind
enum<string>
obrigatório
Opções disponíveis:
cost,
tokens
limit
number
obrigatório

Limite em unidades principais: valor em moeda para custo, contagem de tokens para tokens

thresholds
object[]
obrigatório
Minimum array length: 1
owner
enum<string>
padrão:org

cluster = operador teto (administração-organizacional somente leitura); org = auto-orçamento

Opções disponíveis:
cluster,
org
webhook_url
string<uri> | null
webhook_secret
string | null
Minimum string length: 1

Resposta

200 - application/json

OK

id
string
obrigatório
scope
enum<string>
obrigatório
Opções disponíveis:
org,
apikey
scope_id
string
obrigatório
owner
enum<string>
obrigatório
Opções disponíveis:
cluster,
org
period
enum<string>
obrigatório
Opções disponíveis:
daily,
weekly,
monthly
limit_kind
enum<string>
obrigatório
Opções disponíveis:
cost,
tokens
limit
number
obrigatório
thresholds
object[]
obrigatório
alert_webhook_url
string | null
obrigatório
spend
object
obrigatório