mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-07-30 11:25:08 +00:00
refactor(pricing): fan-out — forge, grok, warp
This commit is contained in:
parent
7bc5f3b044
commit
e28ff73659
4 changed files with 7 additions and 7 deletions
|
|
@ -3,7 +3,6 @@ import { homedir } from 'os'
|
|||
import { join } from 'path'
|
||||
|
||||
import { extractBashCommands } from '../bash-utils.js'
|
||||
import { calculateCost } from '../models.js'
|
||||
import { getSqliteLoadError, isSqliteAvailable, openDatabase, type SqliteDatabase } from '../sqlite.js'
|
||||
import type { ParsedProviderCall, Provider, SessionParser, SessionSource } from './types.js'
|
||||
|
||||
|
|
@ -211,7 +210,7 @@ function createParser(source: SessionSource, seenKeys: Set<string>): SessionPars
|
|||
cachedInputTokens,
|
||||
reasoningTokens: 0,
|
||||
webSearchRequests: 0,
|
||||
costUSD: calculateCost(model, inputTokens, outputTokens, 0, cachedInputTokens, 0),
|
||||
costBasis: 'estimated',
|
||||
tools,
|
||||
bashCommands,
|
||||
timestamp: sqliteTimestampToIso(row.updated_at ?? row.created_at),
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { basename, dirname, join } from 'path'
|
|||
import { homedir } from 'os'
|
||||
|
||||
import { readSessionFile } from '../fs-utils.js'
|
||||
import { calculateCost, getShortModelName } from '../models.js'
|
||||
import { getShortModelName } from '../models.js'
|
||||
import { extractBashCommands } from '../bash-utils.js'
|
||||
import type { Provider, SessionSource, SessionParser, ParsedProviderCall } from './types.js'
|
||||
|
||||
|
|
@ -195,7 +195,7 @@ function createParser(source: SessionSource, seenKeys: Set<string>): SessionPars
|
|||
cachedInputTokens: cacheRead,
|
||||
reasoningTokens: 0,
|
||||
webSearchRequests: 0,
|
||||
costUSD: calculateCost(model, input, output, 0, cacheRead, 0),
|
||||
costBasis: 'estimated',
|
||||
costIsEstimated: true,
|
||||
tools,
|
||||
bashCommands,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { join } from 'path'
|
|||
import { homedir } from 'os'
|
||||
|
||||
import { extractBashCommands } from '../bash-utils.js'
|
||||
import { calculateCost, getShortModelName } from '../models.js'
|
||||
import { getShortModelName } from '../models.js'
|
||||
import { blobToText, getSqliteLoadError, isSqliteAvailable, openDatabase, type SqliteDatabase } from '../sqlite.js'
|
||||
import { estimateTokensFromChars } from '../token-estimate.js'
|
||||
import type { ParsedProviderCall, Provider, SessionParser, SessionSource } from './types.js'
|
||||
|
|
@ -402,7 +402,7 @@ function createParser(source: SessionSource, seenKeys: Set<string>): SessionPars
|
|||
cachedInputTokens: 0,
|
||||
reasoningTokens: 0,
|
||||
webSearchRequests: 0,
|
||||
costUSD: calculateCost(model, inputTokens, 0, 0, 0, 0),
|
||||
costBasis: 'estimated',
|
||||
costIsEstimated: true,
|
||||
tools: exchangeTools.tools,
|
||||
bashCommands: exchangeTools.bashCommands,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { join } from 'path'
|
|||
import { tmpdir } from 'os'
|
||||
|
||||
import { createGrokProvider } from '../../src/providers/grok.js'
|
||||
import { priceProviderCall } from '../../src/pricing-pass.js'
|
||||
import type { ParsedProviderCall } from '../../src/providers/types.js'
|
||||
|
||||
let tmpDir: string
|
||||
|
|
@ -118,7 +119,7 @@ describe('grok provider - parsing', () => {
|
|||
const calls: ParsedProviderCall[] = []
|
||||
if (!source) return calls
|
||||
for await (const call of provider.createSessionParser(source, seen).parse()) {
|
||||
calls.push(call)
|
||||
calls.push(priceProviderCall(call))
|
||||
}
|
||||
return calls
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue