Skip to main content
Use these methods to read org-wide usage totals. They are useful for dashboards, quota checks, and billing reports.
tex.usage.today()                    # today's usage + daily quota
tex.usage.summary()                  # current calendar month
tex.usage.summary(month="2026-03")   # specific month
These helpers are read-only. They do not count toward your quota.

tex.usage.today()

status = tex.usage.today()
tokens_in_used
int
Tokens you’ve sent us today (UTC day).
tokens_out_used
int
Tokens we’ve returned to you today.
tokens_in_limit
int
Daily ingress cap. 1_000_000 on the free tier.
tokens_out_limit
int
Daily egress cap. 5_000_000 on the free tier.
period
str
Always "day_utc".
period_start
str
ISO 8601 timestamp at 00:00 UTC today.
period_end
str
ISO 8601 timestamp at 00:00 UTC tomorrow.
status = tex.usage.today()
print(f"in:  {status.tokens_in_used:,} / {status.tokens_in_limit:,}")
print(f"out: {status.tokens_out_used:,} / {status.tokens_out_limit:,}")
print(f"resets at: {status.period_end}")

tex.usage.summary(month=None)

Calendar-month rollup, UTC.
month
str | None
"YYYY-MM". Omitted = current month.
period
str
Always "month".
start
str
ISO 8601 timestamp of the first second of the month.
end
str
ISO 8601 timestamp of the first second of the next month.
tokens_in
int
Total ingress tokens for the month.
tokens_out
int
Total egress tokens for the month.
import pandas as pd

months = ["2026-01","2026-02","2026-03","2026-04","2026-05"]
df = pd.DataFrame([
    {"month": m, **tex.usage.summary(month=m).__dict__}
    for m in months
])
df.set_index("month")[["tokens_in","tokens_out"]].plot.bar()

Patterns

  • Per-response usage is on every remember and recall:
    hits = tex.recall(q="...", session_id=sid)
    print(hits.usage.tokens_in, hits.usage.tokens_out)
    
  • Quota-aware routing - turn off non-essential memory paths past 90%:
    if tex.usage.today().tokens_in_used > 0.9 * tex.usage.today().tokens_in_limit:
        return generate_without_memory(query)
    
    Cache usage.today() on your side for up to 60 seconds. Use it as a soft guard, not a strict limiter.
  • Usage charts - call summary(month="YYYY-MM") for each of the last 6 months and render the results in your charting library.

Next: Handle errors

Every exception class and how to handle it.