feat(core): update Copilot for token-based billing (#30181)
This commit is contained in:
@@ -1674,6 +1674,20 @@ describe("SessionNs.getUsage", () => {
|
||||
expect(result.cost).toBe(3 + 1.5)
|
||||
})
|
||||
|
||||
test("uses authoritative Copilot billed cost when provided", () => {
|
||||
const result = SessionNs.getUsage({
|
||||
model: createModel({
|
||||
context: 100_000,
|
||||
output: 32_000,
|
||||
cost: { input: 3, output: 15, cache: { read: 0.3, write: 0.3 } },
|
||||
}),
|
||||
usage: usage({ inputTokens: 11_774, outputTokens: 39, totalTokens: 11_813 }),
|
||||
metadata: { copilot: { totalNanoAiu: 4_473_525_000 } },
|
||||
})
|
||||
|
||||
expect(result.cost).toBe(0.04473525)
|
||||
})
|
||||
|
||||
test("uses matching context cost tier before over-200k fallback", () => {
|
||||
const model = createModel({
|
||||
context: 1_000_000,
|
||||
|
||||
Reference in New Issue
Block a user