SIGN IN SIGN UP

feat: support Moonshot chat log probabilities in provider options and metadata (#19577)

## Background

Moonshot AI consumers need token-level confidence data for evaluation,
ranking, and debugging without losing log probabilities returned by Chat
Completions.

## Summary

Added validated logprobs and topLogprobs options, automatic logprobs
enablement, OpenAI-compatible response parsing, and generated or
accumulated streaming metadata at providerMetadata.moonshotai.logprobs.

## Testing

Added provider-option type coverage, request serialization and
validation tests, non-streaming and streaming metadata tests, null and
omitted response coverage, and log-probability fixtures.

## End-to-end Validation

- Ran the new Moonshot generateText log-probabilities example
successfully against the live API.
- Validated final built SDK behavior against live non-streaming and
streaming Moonshot responses, including nullable bytes and accumulated
finish metadata.

## Documentation

Updated the Moonshot provider documentation with options, bounds,
metadata paths, usage guidance, response-shape provenance, and a
consumer example.

## Related Issues

Fixes #19547

Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
A
ai-sdk-factory[bot] committed
1d19b2af30bf84301f2695dd436b08c5d35de74e
Parent: dfa7305
Committed by GitHub <noreply@github.com> on 8/26/2026, 2:21:25 AM