feat: add reasoning_details support#12916
Open
Astricaelus wants to merge 3 commits intoCherryHQ:mainfrom
Open
Conversation
DeJeune
reviewed
Feb 14, 2026
| webSearchResults: [], | ||
| reasoningId: '' | ||
| reasoningId: '', | ||
| reasoningDetails: [] as any[] |
Collaborator
There was a problem hiding this comment.
reasoningdetails有类型我没记错的话
Contributor
Author
There was a problem hiding this comment.
reasoningdetails有类型我没记错的话
确实是有的(https://openrouter.ai/docs/guides/best-practices/reasoning-tokens#reasoning_details-array-structure),不过在通用字段外,3种子类型有各自特殊字段,未来其他模型供应商也可能会带来新的类型。我觉得如果不会对客户端造成什么安全性风险,用Any或许没什么问题?因为使用reasoning_details时,我们已经相信OpenRouter会对数据的合法性、格式对接负责了。
EurFelux
requested changes
Feb 14, 2026
Comment on lines
+208
to
+215
| /** | ||
| * Raw reasoning details from OpenRouter. | ||
| * When present, this should be saved and sent back in subsequent requests | ||
| * to allow models like Claude/Gemini to correctly resume encrypted reasoning. | ||
| * Has higher priority than other reasoning fields. | ||
| */ | ||
| reasoning_details?: any[] | ||
|
|
Collaborator
There was a problem hiding this comment.
provider specific的数据不应该额外添加字段,应该放到providerMetadata字段中
Comment on lines
+237
to
+243
| /** | ||
| * Raw reasoning details from OpenRouter. | ||
| * When present, this should be saved and sent back in subsequent requests | ||
| * to allow models like Claude/Gemini to correctly resume encrypted reasoning. | ||
| * Has higher priority than other reasoning fields. | ||
| */ | ||
| reasoning_details?: any[] |
Collaborator
There was a problem hiding this comment.
这里同样,不要额外添加字段。我们目前所有provider specific的数据都依赖上游providerMetadata处理,你可以看看openrouter aisdk provider的类型定义是否已更新
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Before this PR:
reasoning_detailsfield is not used for OpenRouter Provider, and interleaved thinking is actually not enabled for most of the modelsAfter this PR: Use
reasoning_detailsto pass the reasoning content back to API.Fixes #
Why we need it and why it was done in this way
Better support for interleaved thinking, thus better prompt caching.
Breaking changes
Special notes for your reviewer
Some of the datastructures are changed.
Checklist
This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.
Release note