Skip to content

Commit 5bf7691

Browse files
fix: default value for models with no cost object (anomalyco#1601)
1 parent b1055a7 commit 5bf7691

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/opencode/src/session/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,10 +1344,10 @@ export namespace Session {
13441344
}
13451345
return {
13461346
cost: new Decimal(0)
1347-
.add(new Decimal(tokens.input).mul(model.cost.input).div(1_000_000))
1348-
.add(new Decimal(tokens.output).mul(model.cost.output).div(1_000_000))
1349-
.add(new Decimal(tokens.cache.read).mul(model.cost.cache_read ?? 0).div(1_000_000))
1350-
.add(new Decimal(tokens.cache.write).mul(model.cost.cache_write ?? 0).div(1_000_000))
1347+
.add(new Decimal(tokens.input).mul(model.cost?.input?? 0).div(1_000_000))
1348+
.add(new Decimal(tokens.output).mul(model.cost?.output?? 0).div(1_000_000))
1349+
.add(new Decimal(tokens.cache.read).mul(model.cost?.cache_read ?? 0).div(1_000_000))
1350+
.add(new Decimal(tokens.cache.write).mul(model.cost?.cache_write ?? 0).div(1_000_000))
13511351
.toNumber(),
13521352
tokens,
13531353
}

0 commit comments

Comments
 (0)