Repository navigation
feat(aikit): record thinking levels on assistant messages - #53
Merged
Merged
Conversation
…ant messages Every assistant message now records the thinking level the caller requested (`thinkingLevel`, required, "off" when none) and the provider-native value the request carried (`providerThinkingLevel`, optional). The native value is read off the exact request body: the `start-step` part's body for streamed requests, and `APICallError.requestBodyValues` for rejected ones. Reading the options instead would record efforts the adapter drops, such as OpenAI efforts for model ids the AI SDK does not know. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Codex fetch that rejects before any response now becomes a retryable APICallError carrying the request body, as AI SDK providers do. The network error is retried, aborts and timeouts pass through, and the failed message still records the effort it sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Haiku 5.5 rejects a fixed thinking budget and takes every effort from low to max, so it is sent adaptive thinking with xhigh and max mapped. Unlike Opus and Sonnet 5.5 it accepts disabled thinking, so off stays available. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Haiku 5.5 is the cheap 5.x model in the Anthropic live suites; Fable added cost without coverage Opus 5.5 does not already give. Gemini 3.8 Flash leaves the OpenRouter image suite, and Haiku 5.5 skips the text-only placeholder test, which it declines to answer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Every assistant message now records two thinking fields, stamped by aikit at the wire:
thinkingLevel(required): the level the caller requested, before aikit fits it to the model. It is"off"when no level was requested.providerThinkingLevel(optional): the provider-native value the request actually carried. For example, OpenAIminimalis recorded aslowand OpenAI off asnone. It is left empty for token-budget models and when the request carried no level.providerThinkingLevelis read off the exact request body, not off the options aikit passes to the AI SDK, because the SDK drops OpenAI efforts for model ids it does not recognise:start-steppart.streamTextis now giveninclude: { requestBody: true }.APICallError.requestBodyValues.One reader covers every provider:
reasoning.effort,reasoning_effort, GeminithinkingConfig.thinkingLevel, and Anthropicoutput_config.effortunless thinking is disabled.The harness needs no code change, because the message envelope is persisted whole. Messages stored before this change no longer decode, so local session databases need clearing.
Also in this PR
fetchthat rejects before any response is now wrapped in a retryableAPICallErrorcarrying the request body, as AI SDK providers do. It is retried, aborts and timeouts pass through, and the failed message still records its effort.xhighandmaxmapped. Haiku 5.5 rejects fixed token budgets, takes every effort from low to max, and, unlike Opus and Sonnet 5.5, accepts disabled thinking.claude-sonnet-4-5-20250929and Fable 5.1 in the Anthropic suites.Test plan
vp checkandvp run typecheckare clean.providerThinkingLevelequals the effort on the wire. They cover clamped levels, off, caller overrides, token-budget and disabled thinking, and unknown OpenAI model ids.🤖 Generated with Claude Code