---
title: "Call Stats"
method: POST
path: "/calls/stats"
tags: ["Calls"]
---

# Call Stats

`POST /calls/stats`

## Request

- Base URL: `https://trace.wandb.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://trace.wandb.ai/calls/stats`
- Auth: none declared

## Request body

- CallStatsReq: Request for aggregated call statistics over a time range.
  - `project_id` string, required
  - `start` string, date-time, required: Inclusive start time (UTC, ISO 8601).
  - `end` string, date-time, nullable: Exclusive end time (UTC, ISO 8601). Defaults to now if omitted.
  - `granularity` integer, nullable: Bucket size in seconds (e.g., 3600 for 1 hour). If omitted, auto-selected based on time range. Will be adjusted if it would produce more than 10,000 buckets.
  - `usage_metrics` UsageMetricSpec[], nullable: Usage metrics (tokens, cost) to compute. Grouped by timestamp and model.
    - `metric` 'input_tokens' | 'output_tokens' | 'total_tokens' | 'cache_read_input_tokens' | 'cache_creation_input_tokens' | 'input_cost' | 'output_cost' | 'total_cost', required: Metric to aggregate. Token metrics are normalized across providers.
    - `aggregations` AggregationType[]: Basic aggregation functions to apply
    - `percentiles` number[]: Percentile values to compute (0-100). E.g., [50, 95, 99] for p50, p95, p99
  - `call_metrics` CallMetricSpec[], nullable: Call-level metrics (latency, counts) to compute. Grouped by timestamp only.
    - `metric` 'latency_ms' | 'call_count' | 'error_count', required: Metric to aggregate.
    - `aggregations` AggregationType[]: Basic aggregation functions to apply
    - `percentiles` number[]: Percentile values to compute (0-100). E.g., [50, 95, 99] for p50, p95, p99
  - `filter` CallsFilter
    - `op_names` string[], nullable
    - `input_refs` string[], nullable
    - `output_refs` string[], nullable
    - `parent_ids` string[], nullable
    - `trace_ids` string[], nullable
    - `call_ids` string[], nullable
    - `thread_ids` string[], nullable
    - `turn_ids` string[], nullable
    - `trace_roots_only` boolean, nullable
    - `wb_user_ids` string[], nullable
    - `wb_run_ids` string[], nullable
  - `timezone` string: IANA timezone for bucket alignment (e.g., 'America/New_York')

## Response `200`

Successful Response

- CallStatsRes: Response containing time-series call statistics.
  - `start` string, date-time, required: Resolved start time (UTC)
  - `end` string, date-time, required: Resolved end time (UTC)
  - `granularity` integer, required: Bucket size used (in seconds)
  - `timezone` string, required: Timezone used for bucket alignment
  - `usage_buckets` object[]: Usage metrics by model. Each bucket contains 'timestamp', 'model', and aggregated metric values.
  - `call_buckets` object[]: Call-level metrics. Each bucket contains 'timestamp' and aggregated metric values.

## Other responses

- `422`: Validation Error

## Changes

- **2026-10-16** `dd89fadfe4e4`: 9 info
  - the endpoint scheme security `HTTPBasic` was removed from the API
  - added the new `cache_creation_input_tokens` enum value to the request property `usage_metrics/anyOf[subschema #1]/items/metric`
  - added the new `cache_read_input_tokens` enum value to the request property `usage_metrics/anyOf[subschema #1]/items/metric`
  - added the new `count_false` enum value to the request property `call_metrics/anyOf[subschema #1]/items/aggregations/items/`
  - …5 more
- **2026-01-29** `13059f956116`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/wandb/apis/weights-biases-weave-stainless-api/changes/calls/stats/post.md)

---

[API](https://skmtc.dev/wandb/apis/weights-biases-weave-stainless-api.md) - [All operations](https://skmtc.dev/wandb/apis/weights-biases-weave-stainless-api/llms.txt) - [OpenAPI document](https://skmtc.dev/wandb/apis/weights-biases-weave-stainless-api/revisions/f7643c49bf2e?raw)
