mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
18 lines
527 B
TypeScript
18 lines
527 B
TypeScript
export * as TokenUsage from "./token-usage.js"
|
|
|
|
import { Schema } from "effect"
|
|
|
|
export interface Info extends Schema.Schema.Type<typeof Info> {}
|
|
export const Info = Schema.Struct({
|
|
input: Schema.Finite,
|
|
output: Schema.Finite,
|
|
reasoning: Schema.Finite,
|
|
cache: Schema.Struct({
|
|
read: Schema.Finite,
|
|
write: Schema.Finite,
|
|
}),
|
|
}).annotate({ identifier: "TokenUsage.Info" })
|
|
|
|
export function total(tokens: Info) {
|
|
return tokens.input + tokens.output + tokens.reasoning + tokens.cache.read + tokens.cache.write
|
|
}
|