summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2025-12-03 22:03:42 -0600
committerAiden Cline <[email protected]>2025-12-03 22:03:42 -0600
commit0237905b96a5308a07457d591759ecca752cdc55 (patch)
treec2fd816ec058a5a8339819007c5f622795a67fdd
parente8aa79bab691cab79b17c4811c4cb69d7a46926e (diff)
downloadopencode-0237905b96a5308a07457d591759ecca752cdc55.tar.gz
opencode-0237905b96a5308a07457d591759ecca752cdc55.zip
fix: TypeError: undefined is not an object
-rw-r--r--packages/opencode/src/session/index.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts
index 6a148e973..b8b7af742 100644
--- a/packages/opencode/src/session/index.ts
+++ b/packages/opencode/src/session/index.ts
@@ -432,8 +432,8 @@ export namespace Session {
new Decimal(0)
.add(new Decimal(tokens.input).mul(costInfo?.input ?? 0).div(1_000_000))
.add(new Decimal(tokens.output).mul(costInfo?.output ?? 0).div(1_000_000))
- .add(new Decimal(tokens.cache.read).mul(costInfo?.cache.read ?? 0).div(1_000_000))
- .add(new Decimal(tokens.cache.write).mul(costInfo?.cache.write ?? 0).div(1_000_000))
+ .add(new Decimal(tokens.cache.read).mul(costInfo?.cache?.read ?? 0).div(1_000_000))
+ .add(new Decimal(tokens.cache.write).mul(costInfo?.cache?.write ?? 0).div(1_000_000))
// TODO: update models.dev to have better pricing model, for now:
// charge reasoning tokens at the same rate as output tokens
.add(new Decimal(tokens.reasoning).mul(costInfo?.output ?? 0).div(1_000_000))