Organizations and Projects

Get usage timeseries

Changed on

Buckets model usage over time for one metric, optionally broken down by configured model or agent profile. Covers every project the caller can read in the organization; project_ids and agent_profile_ids narrow that scope. Buckets are calendar days, weeks (starting Monday), or months in timezone.

get/orgs/{orgID}/usage/timeseries

Request

  • Base URL
    https://api.omnara.com/v1
  • Auth
    • HTTP bearer
    • or API key in cookie __Host-omnara_session

Path parameters

orgID, string required

Organization ID (org_...).

Query parameters

since, string date-time

Only tally model calls started at or after this instant. Omit to start from the earliest recorded call.

until, string date-time

Only tally model calls started before this instant. Must be later than since when both are given. Omit to include calls up to now.

timezone, string

IANA time zone that decides where each bucket starts.

interval, 'hour' | 'day' | 'week' | 'month'

Bucket width. Omit to pick one from the window length: days up to 92 days, weeks up to 730 days, months beyond. Hourly buckets are used only when requested. The window may span at most 400 buckets.

metric, 'sum_tokens' | 'sum_input_tokens' | 'sum_output_tokens' | 'sum_cost' | 'count_model_calls'

sum_tokens is input plus output tokens. sum_cost is cost in USD: the model's own pricing when set, otherwise the provider-reported cost, otherwise a list-price estimate; calls that could not be priced contribute nothing. count_model_calls counts model calls that recorded usage.

Value plotted in each bucket. Defaults to sum_tokens.

group_by, 'model' | 'profile'

Break the metric down into one series per group. Omit for a single series.

group_limit, integer

With group_by, how many groups get their own series, ranked by the metric. The rest are folded into one other series.

project_ids, ProjectID[]

Only count usage from these projects.

agent_profile_ids, AgentProfileID[]

Only count usage from top-level agents launched from these agent profiles.

include_subagents, boolean

With agent_profile_ids, also count usage from subagents spawned by those agents.

Response

Usage timeseries.

UsageTimeseries required
metric, 'sum_tokens' | 'sum_input_tokens' | 'sum_output_tokens' | 'sum_cost' | 'count_model_calls' required

sum_tokens is input plus output tokens. sum_cost is cost in USD: the model's own pricing when set, otherwise the provider-reported cost, otherwise a list-price estimate; calls that could not be priced contribute nothing. count_model_calls counts model calls that recorded usage.

interval, 'hour' | 'day' | 'week' | 'month' required
group_by, 'model' | 'profile'
timezone, string required

IANA time zone the buckets follow.

bucket_starts, Timestamp[] required

Start of each bucket in timezone, oldest first, including buckets without usage. The first bucket starts at the beginning of the interval containing since, but only usage at or after since counts.

until, string date-time required

End of the window; usage at or after this instant is excluded.

totals, UsageTotals required

All usage in the window, regardless of metric and group_by.

active_agents, integer required

Agents, not counting subagents, that made at least one model call in the window.

series, UsageTimeseriesSeries[] required

Without group_by, a single all series. With it, one series per ranked group, most first, then an other series when usage remains.

Changes

    • info

      added the required property totals/cost/effective_usd to the response with the status

    • info

      added the required property totals/cost/model_calls_with_effective_cost to the response with the status

    • info

      endpoint added