SIGN IN SIGN UP

fix: preserve complete DeepSeek Chat raw usage objects (#19799)

## Background

DeepSeek JSON and SSE responses lost provider usage fields such as
prompt_tokens_details.cached_tokens from final-step usage.raw, although
normalized counts remained correct.

## Root Cause

Both response paths parsed usage through a strict Zod schema that
omitted prompt_tokens_details and stripped unknown top-level and nested
fields before convertDeepSeekUsage exposed the parsed object as raw.

## Summary

Made the exposed DeepSeek usage schema loose at the top level and within
represented detail objects, explicitly validated cached_tokens, retained
normalized usage calculations, updated snapshots, and added a patch
changeset.

## Testing

Added JSON and SSE production-path regressions covering complete raw
usage preservation, final streaming usage selection, unchanged
normalized counts, unknown fields, and known-field validation.

## End-to-end Validation

- Immutable original reproduction via `replay_original_reproduction`
called live DeepSeek generateText and streamText paths; both raw usage
objects matched provider-boundary usage and the replay returned
`no-longer-reproduces`.

## Related Issues

Fixes #19789

Closes #19793

---------

Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com>
Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
A
ai-sdk-factory[bot] committed
41f016e63324d39342aad25d8d14352246922912
Parent: 8dd86a9
Committed by GitHub <noreply@github.com> on 8/26/2026, 10:33:24 PM