fix(opencode): bump togetherai so streams report usage - #50264
Merged
Merged
Conversation
Together stopped including usage unless stream_options.include_usage is set. @ai-sdk/togetherai@2.0.68 hardcodes that flag. Stay on the 2.x AI SDK v6 line instead of 3.x, which requires @ai-sdk/provider 4.
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.
Fixes #47716.
Summary
V1 records 0 tokens and $0 cost for Together models because
@ai-sdk/togetherai@2.0.41never sendsstream_options.include_usage. Together only returns usage when that flag is set.This bumps the bundled package to
2.0.68inpackages/opencodeandpackages/core. That release hardcodesincludeUsage: trueon chat and completion models. Passing the flag ourselves does not work:createTogetherAIonly readsapiKey,baseURL,headers, andfetch.We are already on the AI SDK v6 line (
@ai-sdk/togetherai2.x,@ai-sdk/provider3.x).3.0.45is the next major and pulls@ai-sdk/provider4, so this stays on2.0.68, the patch that added the flag.Review
TogetherAIProviderSettingsandlanguageModel/chatModelshapes are unchanged from2.0.41.@ai-sdk/openai-compatiblemoves from2.0.37to2.0.62. Chat request fields OpenCode relies on (max_tokens, tools,reasoning_effort) are unchanged. Tool-call streaming is stricter in a compatible way, and SSE errors now forward the error object, which matches the local patch already applied to direct@ai-sdk/openai-compatible@2.0.41.@ai-sdk/provider@3.0.14while the app uses3.0.16.LanguageModelV3is unchanged across that range, and this path does notinstanceofit.openai-compatible@2.0.62,provider@3.0.14, andprovider-utils@4.0.40. Direct provider pins are unchanged. An unused vitest coverage subgraph dropped out of the lockfile.Test plan
stream_options.include_usage: true