SIGN IN SIGN UP

fix: support DeepSeek chat completion log probabilities in requests and normalized results (#19407)

## Background

DeepSeek users could not request or consume content and reasoning token
log probabilities through JSON or streaming chat completions.

## Root Cause

The DeepSeek provider-options schema omitted logprobs fields, so parsing
stripped them before request construction, while the JSON and SSE
response schemas omitted choice logprobs and discarded them during
normalization. The reproduction confirmed all four request and response
gaps.

## Summary

Added validated logprobs and topLogprobs options, forwarded them to
DeepSeek, preserved content and reasoning logprobs in provider metadata,
accumulated streaming logprobs, documented the behavior, and added a
patch changeset.

## Testing

Added JSON and SSE fixtures covering request forwarding, automatic
logprobs enablement, response parsing, reasoning logprobs, byte data,
and streamed aggregation.

## End-to-end Validation

- `pnpm -C examples/ai-functions exec tsx
src/reproduction/deepseek-issue-19377.ts` passed the original recorded
reproduction.
- Live `generateText` call against `deepseek-v4-flash` returned `OK`
with 1 content logprob and 19 reasoning logprobs.

## Related Issues

Fixes #19379

Supersedes #19401 after addressing its Factory review concern.

Closes #19393

---------

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
320b700dadb7c9508c10a37611088951c5f3f093
Parent: 560fc39
Committed by GitHub <noreply@github.com> on 8/24/2026, 11:41:30 PM