Skip to content

Semantics question: in AI Gateway analytics, is a retried provider call one request or two — and do cache hits count? #32983

Description

@roy-tong

Background. AI Gateway logs every proxied request with status, token usage, cost, and duration, and can retry timed-out provider calls (request-handling docs), fall back across providers (Universal Endpoint), and serve responses from cache.

Question or gap. Scenario: 1 client prompt → provider 429/timeout → gateway retry succeeds → 2 provider-side log entries, 1 completion delivered. Later, the identical prompt is served from cache with no provider call. Across those three events, what does "requests" mean in Analytics — client requests, provider attempts, or log rows? For Costs and billing, are cached hits and failed attempts included in request counts or in token/cost totals? A team reporting "we served N requests for $X" gets materially different numbers depending on the answer (here: 3, 2, or 1 requests), and the docs don't seem to define the unit per metric.

Proposed direction. A short docs paragraph defining the counting unit per analytics metric (client request vs. provider attempt vs. cache hit), or an explicit dimension separating attempts from client requests, would make the numbers auditable.

Non-goal. Not pitching anything; we hit this while defining internal usage metering and want Cloudflare's intended semantics.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions