Skip to main content
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>"
}

Authorizations

Authorization
string
header
required

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

Headers

X-On-Behalf-Of
string

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

Query Parameters

start_time
integer
required

Unix timestamp, inclusive

Required range: 0 <= x <= 9007199254740991
end_time
integer
required

Unix timestamp, exclusive

Required range: 0 <= x <= 9007199254740991
org_id
string

Cluster admins only: org whose costs to report (defaults to caller's org)

group_by

Group cost by model / api_key_id (tenant key) / team_id (sub-tenant within an org) / external_user_id (caller-supplied end user, X-On-Behalf-Of, for resale chargeback) / org_id

Available options:
model,
api_key_id,
team_id,
external_user_id,
org_id

Response

200 - application/json

OK

object
any
required
currency
string | null
required
start_time
integer
required
Required range: -9007199254740991 <= x <= 9007199254740991
end_time
integer
required
Required range: -9007199254740991 <= x <= 9007199254740991
group_by
enum<string>[]
required
Available options:
model,
api_key_id,
team_id,
external_user_id,
org_id
data
object[]
required
total_cost
number
required
total_cost_nano
string
required

Total cost in integer NANO-units (1e9 per major unit, NOT cents); use total_cost for the major amount.