Skip to content

Commit 0237905

Browse files
committed
fix: TypeError: undefined is not an object
1 parent e8aa79b commit 0237905

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/opencode/src/session/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,8 @@ export namespace Session {
432432
new Decimal(0)
433433
.add(new Decimal(tokens.input).mul(costInfo?.input ?? 0).div(1_000_000))
434434
.add(new Decimal(tokens.output).mul(costInfo?.output ?? 0).div(1_000_000))
435-
.add(new Decimal(tokens.cache.read).mul(costInfo?.cache.read ?? 0).div(1_000_000))
436-
.add(new Decimal(tokens.cache.write).mul(costInfo?.cache.write ?? 0).div(1_000_000))
435+
.add(new Decimal(tokens.cache.read).mul(costInfo?.cache?.read ?? 0).div(1_000_000))
436+
.add(new Decimal(tokens.cache.write).mul(costInfo?.cache?.write ?? 0).div(1_000_000))
437437
// TODO: update models.dev to have better pricing model, for now:
438438
// charge reasoning tokens at the same rate as output tokens
439439
.add(new Decimal(tokens.reasoning).mul(costInfo?.output ?? 0).div(1_000_000))

0 commit comments

Comments
 (0)