fix(ai): show implied Kimi Coding subscription costs

This commit is contained in:
Armin Ronacher
2026-07-17 10:00:40 +02:00
parent 58575888f5
commit 8881e17625
7 changed files with 70 additions and 21 deletions
+1
View File
@@ -5,6 +5,7 @@
### Fixed
- Fixed obsolete custom UI, custom tool, and custom editor examples in the extension documentation ([#6735](https://github.com/earendil-works/pi/issues/6735)).
- Fixed Kimi Coding sessions to show API-equivalent implied costs with the subscription indicator.
## [0.80.10] - 2026-07-16
@@ -137,8 +137,10 @@ export class FooterComponent implements Component {
if ((totalCacheRead > 0 || totalCacheWrite > 0) && latestCacheHitRate !== undefined) {
statsParts.push(`CH${latestCacheHitRate.toFixed(1)}%`);
}
// Show cost with "(sub)" indicator if using OAuth subscription
const usingSubscription = state.model ? this.session.modelRuntime.isUsingOAuth(state.model.provider) : false;
// Kimi Coding is subscription-backed despite using API-key authentication.
const usingSubscription = state.model
? state.model.provider === "kimi-coding" || this.session.modelRuntime.isUsingOAuth(state.model.provider)
: false;
if (totalCost || usingSubscription) {
const costStr = `$${totalCost.toFixed(3)}${usingSubscription ? " (sub)" : ""}`;
statsParts.push(costStr);
@@ -141,4 +141,21 @@ describe("FooterComponent width handling", () => {
const statsLine = stripAnsi(footer.render(120)[1]);
expect(statsLine).toContain("CH25.0%");
});
it("marks Kimi Coding costs as subscription estimates", () => {
const session = createSession({
sessionName: "",
provider: "kimi-coding",
usage: {
input: 100,
output: 10,
cacheRead: 0,
cacheWrite: 0,
cost: { total: 1.234 },
},
});
const footer = new FooterComponent(session, createFooterData(1));
expect(stripAnsi(footer.render(120)[1])).toContain("$1.234 (sub)");
});
});