Files
coder/coderd
Susana Ferreira e5a449e172 feat: record provider model on AI Gateway token usage (#30086)
## Description

Record the model reported by the upstream provider on each AI Gateway
token usage and send it to coderd as `provider_model` on
`RecordTokenUsageRequest`. The provider can report a different model
than the one requested (for example, an alias or a dated snapshot), and
pricing only by the requested model leaves those requests unpriced.

This PR only captures and transmits the model. coderd ignores it for
now, and storing it and using it for price lookup will be added upstack.

Related to https://linear.app/codercom/issue/AIGOV-650

## Changes

- Add `ProviderModel` to `recorder.TokenUsageRecord`, set from the
response `model` in the messages, chat completions, and responses
interceptors (blocking and streaming).
- Add `provider_model` to `RecordTokenUsageRequest`, as part of the
unreleased aibridged API v1.3.
- Assert the recorded provider model in the interceptor and integration
tests.

> [!NOTE]
> Generated by Claude Code on behalf of @ssncferreira.
2026-09-29 17:47:27 +01:00
..