usage
GET /v1/usage — billing and usage reporting.
Usage summary for the current billing period. Exposed via speko.usage.
summary = speko.usage.get()
print(summary.total_sessions, summary.total_minutes, summary.total_cost)
print(summary.balance_usd)Signature
Speko.usage.get(
*,
from_date: str | None = None,
to_date: str | None = None,
) -> UsageSummaryawait AsyncSpeko.usage.get(
*,
from_date: str | None = None,
to_date: str | None = None,
) -> UsageSummaryBoth parameters accept ISO-8601 dates or datetimes. Omit either to default to the current billing period.
Returns — UsageSummary
total_sessionsinttotal_minutesfloattotal_costfloatTotal cost in USD over the range: minutes_cost + add_on_cost.
minutes_costfloatCost of the per-minute call rate.
add_on_costfloatCost of everything billed on top of the minute: telephony, speech-to-speech backend tokens, phone numbers.
breakdownlist[UsageByProvider]Per-provider rollup — see below.
balance_usdfloatCurrent organization balance in USD.
currency'USD'UsageByProvider
providerstringmetricstringBillable metric (e.g. session_seconds, llm_tokens, telephony_inbound_seconds).
charge_kind'minutes' | 'add_on' | 'included' | 'free' | 'byok'How the line bills: the per-minute rate, an add-on on top of it, covered by the minute, absorbed by Speko (post-call summaries), or run on your own key.
key_source'BYOK' | 'MANAGED'BYOK = customer key, no Speko margin. MANAGED = platform key, billed to the org.
quantityfloatcostfloatCost in USD for this row.
Example — last 24 hours
from datetime import datetime, timedelta, timezone
now = datetime.now(timezone.utc)
yesterday = now - timedelta(hours=24)
summary = speko.usage.get(
from_date=yesterday.isoformat(),
to_date=now.isoformat(),
)
for row in summary.breakdown:
print(f"{row.charge_kind}\t{row.provider}\t{row.quantity} {row.metric}\t${row.cost}")