Median

GET /analytics/billing

Updated Oct 1, 20261 minute read

Spend and model calls

What the window cost, in microcredits: spend per day by service, model calls per day split into automatic and team-started, tokens per day, and conversation spend with how many conversations it covered. capped means the read stopped before the window's first day.

Part of Analytics.

Parameters

NameInTypeRequiredDescription
fromqueryintegerNoThe window's start, unix ms. Defaults to days ago.
daysquery7 | 30 | 90NoDaily buckets after from. Default 30.

Responses

StatusDescription
200The window's spend.
400The request is malformed, and the message names the field.
401The bearer token is missing, revoked, or expired.
429Too many requests. Wait the seconds in Retry-After. Limits depend on the plan. See rate limits.

200 body

FieldTypeRequiredDescription
spendobjectNo
spend.totalintegerNo
spend.perDayobjectNo
spend.perDay.aiinteger[]No
spend.perDay.emailinteger[]No
spend.perDay.scrapeinteger[]No
requestsobjectNo
requests.totalintegerNo
requests.automaticinteger[]No
requests.teaminteger[]No
requests.tokensinteger[]No
perConversationobjectNo
perConversation.spendintegerNo
perConversation.conversationsintegerNo
perConversation.perDaySpendinteger[]No
perConversation.perDayConversationsinteger[]No
perMessageobjectNo
perMessage.spendintegerNo
perMessage.messagesintegerNo
perMessage.perDaySpendinteger[]No
perMessage.perDayMessagesinteger[]No
cappedbooleanNo

Example request

curl https://api.median.sh/v1/analytics/billing \
  -H "Authorization: Bearer $BEARER_AUTH"

Still need help?

    Esc