diff options
| author | Melih Mucuk <[email protected]> | 2025-11-12 21:59:35 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-11-12 13:59:35 -0600 |
| commit | b63b6d04c6add179f4a8d764ed6e811298aafa11 (patch) | |
| tree | 72988b7f547227f4d6570ae8252011214de6c046 | |
| parent | 8addaa7e084f8bb9a838610b311aa1110dada659 (diff) | |
| download | opencode-b63b6d04c6add179f4a8d764ed6e811298aafa11.tar.gz opencode-b63b6d04c6add179f4a8d764ed6e811298aafa11.zip | |
Fix usage & billing for custom model aliases and cached/reasoning tokens (#4222)
Co-authored-by: Melih Mucuk <[email protected]>
Co-authored-by: Aiden Cline <[email protected]>
| -rw-r--r-- | packages/opencode/src/session/index.ts | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts index dff23c24d..b920ca23c 100644 --- a/packages/opencode/src/session/index.ts +++ b/packages/opencode/src/session/index.ts @@ -402,6 +402,9 @@ export namespace Session { .add(new Decimal(tokens.output).mul(input.model.cost?.output ?? 0).div(1_000_000)) .add(new Decimal(tokens.cache.read).mul(input.model.cost?.cache_read ?? 0).div(1_000_000)) .add(new Decimal(tokens.cache.write).mul(input.model.cost?.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(input.model.cost?.output ?? 0).div(1_000_000)) .toNumber(), tokens, } |
