Skip to content

Commit 3387a9d

Browse files
committed
fix(usage): add qwen3.8-max-preview temporary Routeway pricing for both alibaba token plans
1 parent b7ce5aa commit 3387a9d

4 files changed

Lines changed: 29 additions & 5 deletions

File tree

src/providers/registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ export const PROVIDER_REGISTRY: readonly ProviderRegistryEntry[] = [
642642
id: "google", label: "Google Gemini", adapter: "google", baseUrl: "https://generativelanguage.googleapis.com", authKind: "key", featured: true,
643643
dashboardUrl: "https://aistudio.google.com/apikey", defaultModel: "gemini-3.5-flash", models: ["gemini-3.6-flash", "gemini-3.5-flash", "gemini-3.5-flash-lite", "gemini-3.1-pro-preview"],
644644
modelContextWindows: { "gemini-3.6-flash": 1_048_576, "gemini-3.5-flash": 1_000_000, "gemini-3.5-flash-lite": 1_048_576 },
645-
modelInputModalities: { "gemini-3.6-flash": ["text", "image"], "gemini-3.5-flash-lite": ["text"] },
645+
modelInputModalities: { "gemini-3.6-flash": ["text", "image"], "gemini-3.5-flash-lite": ["text", "image"] },
646646
modelReasoningEfforts: {
647647
"gemini-3.6-flash": ["minimal", "low", "medium", "high"],
648648
"gemini-3.5-flash": ["minimal", "low", "medium", "high"],

src/usage/expected-prices.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,17 @@ const KIMI_K27_CODE: Cost4 = { input: 0.95, output: 4, cacheRead: 0.19, cacheWri
3737
const KIMI_K27_CODE_HIGHSPEED: Cost4 = { input: 1.9, output: 8, cacheRead: 0.38, cacheWrite: 1.9 };
3838
const KIMI_K26: Cost4 = { input: 0.95, output: 4, cacheRead: 0.16, cacheWrite: 0.95 };
3939
const KIMI_K25: Cost4 = { input: 0.6, output: 3, cacheRead: 0.1, cacheWrite: 0.6 };
40+
const QWEN38_ROUTEWAY_TEMPORARY: Cost4 = { input: 1.5, output: 5, cacheRead: 0.15, cacheWrite: 0 };
4041

4142
const GEMINI_PRICING = "https://ai.google.dev/gemini-api/docs/pricing (2026-07-22); cacheWrite=0: storage is billed per-hour, not per-token";
4243
const MINIMAX_PRICING = "https://platform.minimax.io/docs/guides/pricing-paygo";
4344
const DEEPSEEK_PRICING = "https://api-docs.deepseek.com/quick_start/pricing-details-usd; V4 Flash alias transition scheduled 2026-07-24 — re-verify after";
4445
// Kimi official tables publish input/output/cache-hit only; cacheWrite is mapped to the
4546
// cache-miss input price (Kimi auto-caches with no separate write billing). 2026-07-20 re-verified.
4647
const KIMI_PRICING = "https://platform.kimi.ai/docs/pricing (official table; cacheWrite derived = input, Kimi auto-cache has no write billing)";
48+
// TEMPORARY proxy only: Routeway's reseller API rate is not Alibaba Token Plan billing.
49+
// Replace these overlays when Alibaba publishes an official qwen3.8-max-preview token rate.
50+
const QWEN38_ROUTEWAY_PRICING = "https://routeway.ai/models/qwen3.8-max-preview (temporary reseller proxy; NOT Alibaba Token Plan billing; cacheWrite unpublished -> 0)";
4751

4852
export const EXPECTED_PRICE_OVERLAYS: readonly ExpectedPriceOverlay[] = [
4953
// MiniMax M2.1 highspeed — published PAYG price (verified).
@@ -95,6 +99,10 @@ export const EXPECTED_PRICE_OVERLAYS: readonly ExpectedPriceOverlay[] = [
9599
{ provider: "kimi-code", modelId: "kimi-k2.6", cost4: KIMI_K26, source: KIMI_PRICING, verifiedAt: "2026-07-20", status: "verified-derived" },
96100
{ provider: "kimi-code", modelId: "kimi-k2.5", cost4: KIMI_K25, source: KIMI_PRICING, verifiedAt: "2026-07-20", status: "verified-derived" },
97101
{ provider: "kimi-code", modelId: "kimi-for-coding", cost4: KIMI_K27_CODE, source: `derived: kimi-k2.7-code ${KIMI_PRICING}`, verifiedAt: "2026-07-20", status: "verified-derived" },
102+
// Alibaba has not published a per-token Token Plan rate yet. Use Routeway's
103+
// independently published reseller rate temporarily and keep estimates derived.
104+
{ provider: "alibaba-token-plan", modelId: "qwen3.8-max-preview", cost4: QWEN38_ROUTEWAY_TEMPORARY, source: QWEN38_ROUTEWAY_PRICING, verifiedAt: "2026-07-22", status: "verified-derived" },
105+
{ provider: "alibaba-token-plan-intl", modelId: "qwen3.8-max-preview", cost4: QWEN38_ROUTEWAY_TEMPORARY, source: QWEN38_ROUTEWAY_PRICING, verifiedAt: "2026-07-22", status: "verified-derived" },
98106
// Cursor Auto router — Cursor's published fixed token price (verified).
99107
{ provider: "cursor", modelId: "auto", cost4: { input: 1.25, output: 6, cacheRead: 0.25, cacheWrite: 1.25 }, source: "https://docs.cursor.com/account/pricing + https://cursor.com/blog/aug-2025-pricing", verifiedAt: "2026-07-20", status: "verified" },
100108
];

tests/google-hardening.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ describe("google provider hardening", () => {
166166
expect(vertex?.defaultModel).toBe("gemini-3-pro");
167167
});
168168

169-
test("registers gemini-3.5-flash-lite with its text-only context metadata", () => {
169+
test("registers gemini-3.5-flash-lite with its multimodal context metadata", () => {
170170
const google = PROVIDER_REGISTRY.find(entry => entry.id === "google");
171171

172172
expect(google?.models).toContain("gemini-3.5-flash-lite");
173173
expect(google?.modelContextWindows?.["gemini-3.5-flash-lite"]).toBe(1_048_576);
174-
expect(google?.modelInputModalities?.["gemini-3.5-flash-lite"]).toEqual(["text"]);
174+
expect(google?.modelInputModalities?.["gemini-3.5-flash-lite"]).toEqual(["text", "image"]);
175175
});
176176
});

tests/usage-cost.test.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,20 @@ describe("resolveMatchedPrice", () => {
134134
expect(price?.cost4.input).toBe(0.25);
135135
});
136136

137+
test("17f. Alibaba Token Plan Qwen 3.8 uses the temporary Routeway proxy", () => {
138+
for (const provider of ["alibaba-token-plan", "alibaba-token-plan-intl"]) {
139+
const price = resolveMatchedPrice(provider, "qwen3.8-max-preview");
140+
expect(price).toMatchObject({
141+
provider,
142+
modelId: "qwen3.8-max-preview",
143+
cost4: { input: 1.5, output: 5, cacheRead: 0.15, cacheWrite: 0 },
144+
source: "expected",
145+
status: "verified-derived",
146+
});
147+
expect(price?.sourceRef).toContain("temporary reseller proxy");
148+
}
149+
});
150+
137151
test("6. unmatched exact key is null", () => {
138152
expect(resolveMatchedPrice("no-such-provider", "no-such-model")).toBeNull();
139153
expect(resolveMatchedPrice("openai", "definitely-not-a-model")).toBeNull();
@@ -174,8 +188,8 @@ describe("resolveMatchedPrice", () => {
174188
expect(resolveMatchedPrice("openrouter", "anthropic-claude-3.5-sonnet")).toBeNull();
175189
});
176190

177-
test("16. shipped overlay membership: 39 keys, including Gemini 3.6 and compatibility prices", () => {
178-
expect(EXPECTED_PRICE_OVERLAYS.length).toBe(39);
191+
test("16. shipped overlay membership: 41 keys, including Gemini 3.6 and compatibility prices", () => {
192+
expect(EXPECTED_PRICE_OVERLAYS.length).toBe(41);
179193
expect(EXPECTED_PRICE_OVERLAYS.some(row => row.status === "unverified")).toBe(false);
180194
const keys = new Set(EXPECTED_PRICE_OVERLAYS.map(row => `${row.provider}/${row.modelId}`));
181195
for (const expected of [
@@ -217,6 +231,8 @@ describe("resolveMatchedPrice", () => {
217231
"kimi-code/kimi-k2.6",
218232
"kimi-code/kimi-k2.5",
219233
"kimi-code/kimi-for-coding",
234+
"alibaba-token-plan/qwen3.8-max-preview",
235+
"alibaba-token-plan-intl/qwen3.8-max-preview",
220236
"cursor/auto",
221237
]) {
222238
expect(keys.has(expected)).toBe(true);

0 commit comments

Comments
 (0)