mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-11-29 02:39:13 +00:00
refactor(mux): drop dead openai reasoning fallback (#446)
usage.reasoningTokens is the AI SDK v6 normalized field across all provider families, so the providerMetadata.openai fallback never fired. Removed it and the now-unused openai extraction.
This commit is contained in:
parent
e0051fc403
commit
cef1a6b669
1 changed files with 3 additions and 2 deletions
|
|
@ -183,14 +183,15 @@ function createParser(source: SessionSource, seenKeys: Set<string>): SessionPars
|
|||
|
||||
const pm = meta.providerMetadata ?? {}
|
||||
const anthropic = asRecord(pm['anthropic'])
|
||||
const openai = asRecord(pm['openai'])
|
||||
|
||||
// mux reports inputTokens inclusive of cache read+creation and
|
||||
// outputTokens inclusive of reasoning; decompose to codeburn's
|
||||
// cache/reasoning-exclusive convention. Cache creation is Anthropic-only.
|
||||
// The AI SDK v6 normalizes reasoning into usage.reasoningTokens across
|
||||
// every provider family, so that field is the single source of truth.
|
||||
const cacheRead = num(usage['cachedInputTokens'])
|
||||
const cacheCreate = num(anthropic?.['cacheCreationInputTokens'])
|
||||
const reasoning = num(usage['reasoningTokens']) || num(openai?.['reasoningTokens'])
|
||||
const reasoning = num(usage['reasoningTokens'])
|
||||
const inputTokens = Math.max(0, num(usage['inputTokens']) - cacheRead - cacheCreate)
|
||||
const outputTokens = Math.max(0, num(usage['outputTokens']) - reasoning)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue