diff options
| author | Mahamed-Belkheir <[email protected]> | 2025-08-04 23:45:35 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-04 16:45:35 -0500 |
| commit | 5bf7691ea601cf6a783a0e13f6862b0d0f27269b (patch) | |
| tree | 193e1890555e72a239e8911a988a6a4025b23eb3 /packages | |
| parent | b1055a74d3e0b39c61307eb10169ccffb9ec47e5 (diff) | |
| download | opencode-5bf7691ea601cf6a783a0e13f6862b0d0f27269b.tar.gz opencode-5bf7691ea601cf6a783a0e13f6862b0d0f27269b.zip | |
fix: default value for models with no cost object (#1601)
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/opencode/src/session/index.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts index 63c135492..efd9ee5a0 100644 --- a/packages/opencode/src/session/index.ts +++ b/packages/opencode/src/session/index.ts @@ -1344,10 +1344,10 @@ export namespace Session { } return { cost: new Decimal(0) - .add(new Decimal(tokens.input).mul(model.cost.input).div(1_000_000)) - .add(new Decimal(tokens.output).mul(model.cost.output).div(1_000_000)) - .add(new Decimal(tokens.cache.read).mul(model.cost.cache_read ?? 0).div(1_000_000)) - .add(new Decimal(tokens.cache.write).mul(model.cost.cache_write ?? 0).div(1_000_000)) + .add(new Decimal(tokens.input).mul(model.cost?.input?? 0).div(1_000_000)) + .add(new Decimal(tokens.output).mul(model.cost?.output?? 0).div(1_000_000)) + .add(new Decimal(tokens.cache.read).mul(model.cost?.cache_read ?? 0).div(1_000_000)) + .add(new Decimal(tokens.cache.write).mul(model.cost?.cache_write ?? 0).div(1_000_000)) .toNumber(), tokens, } |
