fix(catalog): used live copilot default-tier prices

Applied GitHub Copilot's discovered default token-price tier to base models while preserving the provider fallback for unreported cache-write costs. Added regression coverage for GPT-5.6 Luna base and long-context pricing.

Fixes #7471
This commit is contained in:
roboomp
2026-08-03 08:38:14 +00:00
parent 5039b33a11
commit 27c1d6e8d4
3 changed files with 31 additions and 0 deletions
+4
View File
@@ -2,6 +2,10 @@
## [Unreleased]
### Fixed
- Fixed GitHub Copilot dynamic discovery retaining stale bundled prices for default-context models instead of using the provider's reported default-tier prices ([#7471](https://github.com/can1357/oh-my-pi/issues/7471)).
## [17.2.5] - 2026-08-03
### Fixed
@@ -5050,6 +5050,11 @@ export function githubCopilotModelManagerOptions(config?: GithubCopilotModelMana
}
: {}),
};
const defaultCost = copilotTierCost(tokenPrices.defaultTier);
if (defaultCost) {
// Cache writes are not reported per tier; retain the bundled provider rate.
base.cost = { ...defaultCost, cacheWrite: base.cost.cacheWrite };
}
const variant = createCopilotLongContextVariant(
base,
contextWindow,
@@ -545,6 +545,28 @@ describe("github copilot tiered context windows", () => {
expect(variant?.cost).toEqual({ input: 4, output: 18, cacheRead: 0.4, cacheWrite: 0 });
});
it("prices the base model from its default tier", async () => {
const { models } = await discoverCopilotModels({
data: [
tieredCopilotEntry({
id: "gpt-5.6-luna",
name: "GPT-5.6 Luna",
window: 1_050_000,
maxOutput: 50_000,
defaultContextMax: 200_000,
longContextMax: 1_000_000,
defaultPrices: { input: 20, output: 120, cache: 2 },
longPrices: { input: 40, output: 180, cache: 4 },
}),
],
});
const base = models.find(candidate => candidate.id === "gpt-5.6-luna");
expect(base?.cost).toMatchObject({ input: 0.2, output: 1.2, cacheRead: 0.02 });
const variant = models.find(candidate => candidate.id === "gpt-5.6-luna-1m");
expect(variant?.cost).toMatchObject({ input: 0.4, output: 1.8, cacheRead: 0.04 });
});
it("keeps legacy tier-capped responses unchanged and synthesizes no variant", async () => {
const { models } = await discoverCopilotModels({
data: [