Skip to content

Reasoning tokens are charged at the output rate regardless of the model's reasoning price #24231

@willsarg

Description

@willsarg

Session.getUsage hardcodes reasoning tokens at the output rate:

// 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))

Models with a distinct reasoning price aren't costed correctly. Add an optional reasoning field to the cost schemas and use it in getUsage, falling back to the output rate when unset. Backward compatible.

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions