Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit b63b6d0

Browse files
Fix usage & billing for custom model aliases and cached/reasoning tokens (anomalyco#4222)
Co-authored-by: Melih Mucuk <melih@monkeysteam.com> Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
1 parent 8addaa7 commit b63b6d0

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

packages/opencode/src/session/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@ export namespace Session {
402402
.add(new Decimal(tokens.output).mul(input.model.cost?.output ?? 0).div(1_000_000))
403403
.add(new Decimal(tokens.cache.read).mul(input.model.cost?.cache_read ?? 0).div(1_000_000))
404404
.add(new Decimal(tokens.cache.write).mul(input.model.cost?.cache_write ?? 0).div(1_000_000))
405+
// TODO: update models.dev to have better pricing model, for now:
406+
// charge reasoning tokens at the same rate as output tokens
407+
.add(new Decimal(tokens.reasoning).mul(input.model.cost?.output ?? 0).div(1_000_000))
405408
.toNumber(),
406409
tokens,
407410
}

0 commit comments

Comments
 (0)