integrate cache read/write data
This commit is contained in:
parent
d1f9311931
commit
b470466e30
2 changed files with 12 additions and 2 deletions
|
|
@ -17,8 +17,8 @@ export namespace ModelsDev {
|
||||||
cost: z.object({
|
cost: z.object({
|
||||||
input: z.number(),
|
input: z.number(),
|
||||||
output: z.number(),
|
output: z.number(),
|
||||||
inputCached: z.number(),
|
cache_read: z.number().optional(),
|
||||||
outputCached: z.number(),
|
cache_write: z.number().optional(),
|
||||||
}),
|
}),
|
||||||
limit: z.object({
|
limit: z.object({
|
||||||
context: z.number(),
|
context: z.number(),
|
||||||
|
|
|
||||||
|
|
@ -759,6 +759,16 @@ export namespace Session {
|
||||||
cost: new Decimal(0)
|
cost: new Decimal(0)
|
||||||
.add(new Decimal(tokens.input).mul(model.cost.input).div(1_000_000))
|
.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.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),
|
||||||
|
)
|
||||||
.toNumber(),
|
.toNumber(),
|
||||||
tokens,
|
tokens,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue