Skip to content

fix(opencode): bump togetherai so streams report usage - #50264

Merged
rekram1-node merged 1 commit into
devfrom
together-usage
Sep 21, 2026
Merged

rekram1-node merged 1 commit into
devfrom
together-usage

Conversation

@rekram1-node

Copy link
Copy Markdown
Collaborator

Fixes #47716.

Summary

V1 records 0 tokens and $0 cost for Together models because @ai-sdk/togetherai@2.0.41 never sends stream_options.include_usage. Together only returns usage when that flag is set.

This bumps the bundled package to 2.0.68 in packages/opencode and packages/core. That release hardcodes includeUsage: true on chat and completion models. Passing the flag ourselves does not work: createTogetherAI only reads apiKey, baseURL, headers, and fetch.

We are already on the AI SDK v6 line (@ai-sdk/togetherai 2.x, @ai-sdk/provider 3.x). 3.0.45 is the next major and pulls @ai-sdk/provider 4, so this stays on 2.0.68, the patch that added the flag.

Review

  • Public TogetherAIProviderSettings and languageModel / chatModel shapes are unchanged from 2.0.41.
  • Nested @ai-sdk/openai-compatible moves from 2.0.37 to 2.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.
  • Together nests @ai-sdk/provider@3.0.14 while the app uses 3.0.16. LanguageModelV3 is unchanged across that range, and this path does not instanceof it.
  • Lockfile blast radius is the togetherai alias plus its nested openai-compatible@2.0.62, provider@3.0.14, and provider-utils@4.0.40. Direct provider pins are unchanged. An unused vitest coverage subgraph dropped out of the lockfile.

Test plan

  • Together streaming request body includes stream_options.include_usage: true
  • Assistant message usage and cost are non-zero for a Together chat model
  • A Together tool-call turn still completes and records usage

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.
@rekram1-node
rekram1-node merged commit 8bf288e into dev Sep 21, 2026
11 checks passed
@rekram1-node
rekram1-node deleted the together-usage branch September 21, 2026 02:01
rldona pushed a commit to rldona/FlupCode that referenced this pull request Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Together AI: token usage always 0 — bundled @ai-sdk/togetherai doesn't send stream_options.include_usage

1 participant