SIGN IN SIGN UP

fix: preserve complete raw usage objects for Mistral chat responses (#19893)

## Background

Mistral chat dropped provider-returned usage fields such as service_tier
from usage.raw in normal and streaming responses.

## Root Cause

The shared Mistral usage Zod schema used strict objects, which stripped
unmodeled top-level and nested fields before convertMistralUsage exposed
the parsed object as raw.

## Summary

Expanded validation for known Mistral usage fields and added JSON
catchalls to usage and detail objects while leaving normalized token
accounting unchanged. Added a patch changeset for @ai-sdk/mistral.

## Testing

Added normal and SSE regression fixtures covering service_tier,
officially modeled fields, unknown fields, known-field validation,
unchanged normalization, and final streaming usage selection.

## End-to-end Validation

- `pnpm -C examples/ai-functions exec tsx -e '<live Mistral usage
audit>'` — live normal and streaming calls to `mistral-small-latest`
preserved `service_tier: "standard"` and deeply matched
provider-boundary usage.
- `replay_original_reproduction` — the immutable reproduction exited
successfully with `rawMatches: true` for normal and streaming responses.

## Related Issues

Fixes #19870

Closes #19881

---------

Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com>
Co-authored-by: gr2m <39992+gr2m@users.noreply.github.com>
A
ai-sdk-factory[bot] committed
e83d6dc26bd82a48eefb0fc007f1e76de61c70f3
Parent: 90192f1
Committed by GitHub <noreply@github.com> on 8/27/2026, 11:03:37 PM