Pular para o conteúdo principal
GET
/
api
/
v1
/
llm
/
usage
/
costs
Python (SDK)
from meetkai_mka1 import SDK


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

    res = sdk.llm.usage.costs(start_time=612474, end_time=211313)

    # Handle response
    print(res)
{
  "object": "<unknown>",
  "currency": "<string>",
  "start_time": 0,
  "end_time": 0,
  "group_by": [],
  "data": [
    {
      "model": "<string>",
      "api_key_id": "<string>",
      "team_id": "<string>",
      "external_user_id": "<string>",
      "org_id": "<string>",
      "cost": 123,
      "cost_nano": "<string>"
    }
  ],
  "total_cost": 123,
  "total_cost_nano": "<string>"
}

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>.

Cabeçalhos

X-On-Behalf-Of
string

Optional external end-user identifier forwarded by the API gateway.

Parâmetros de consulta

start_time
integer
obrigatório

Timestamp Unix, inclusivo

Intervalo obrigatório: 0 <= x <= 9007199254740991
end_time
integer
obrigatório

Timestamp Unix, exclusivo

Intervalo obrigatório: 0 <= x <= 9007199254740991
org_id
string

Apenas para administradores de cluster: organização cujos custos devem ser relatados (padrão é a organização do chamador)

group_by

Custo do grupo por modelo / api_key_id (chave do inquilino) / team_id (sub-inquilino dentro de uma organização) / external_user_id (usuário final fornecido pelo chamador, X-On-Behalf-Of, para chargeback de revenda) / org_id

Opções disponíveis:
model,
api_key_id,
team_id,
external_user_id,
org_id

Resposta

200 - application/json

OK

object
any
obrigatório
currency
string | null
obrigatório
start_time
integer
obrigatório
Intervalo obrigatório: -9007199254740991 <= x <= 9007199254740991
end_time
integer
obrigatório
Intervalo obrigatório: -9007199254740991 <= x <= 9007199254740991
group_by
enum<string>[]
obrigatório
Opções disponíveis:
model,
api_key_id,
team_id,
external_user_id,
org_id
data
object[]
obrigatório
total_cost
number
obrigatório
total_cost_nano
string
obrigatório

Custo total em unidades NANO inteiras (1e9 por unidade principal, NÃO centavos); use total_cost para o valor principal.