From d24ff57bc4dd53afbbb1d2c972266e6d89ea5c24 Mon Sep 17 00:00:00 2001 From: lidge-jun Date: Tue, 8 Sep 2026 17:44:26 +0900 Subject: [PATCH 1/2] release: set main channel version 2.48.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7d94d23cab..6547da6552 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bitkyc08/opencodex", - "version": "2.47.0", + "version": "2.48.0", "description": "Universal provider proxy for OpenAI Codex & Claude Code — use any LLM with Codex CLI/App/SDK and Claude Code", "type": "module", "main": "./bin/package-main.mjs", From 75e9a1164524b5ee3d493f5a06d04f4a6c3dbad3 Mon Sep 17 00:00:00 2001 From: luvs01 Date: Sat, 12 Sep 2026 10:30:58 +0900 Subject: [PATCH 2/2] fix(catalog): account for auxiliary model charges --- src/codex/catalog/provider-fetch.ts | 14 +++++++----- .../catalog-free-pricing-status.test.ts | 22 +++++++++++++++++++ 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/codex/catalog/provider-fetch.ts b/src/codex/catalog/provider-fetch.ts index cf4e4dddef..eacff8ed7f 100644 --- a/src/codex/catalog/provider-fetch.ts +++ b/src/codex/catalog/provider-fetch.ts @@ -1425,10 +1425,11 @@ function discoveredPricingRate(value: unknown): number | undefined { /** * Cost class for one discovered row, read from the provider's own `pricing` object (#3666). * - * Fail closed. Only a complete pair of non-negative numeric rates classifies at all; a missing, - * one-sided, non-numeric, or negative rate is "unknown" and therefore excluded from a free-only - * filter. Showing a paid model under a Free filter spends the user's money, while hiding a free - * one costs a click. + * Fail closed. Any positive numeric component proves the model is paid. Calling it free requires + * a complete prompt/completion pair and every published pricing component to be a non-negative + * numeric zero; an unsupported component is "unknown" because it may describe another charge. + * Showing a paid model under a Free filter spends the user's money, while hiding a free one costs + * a click. * * Two things that look like evidence and are not. A `:free` id suffix is an OpenRouter naming * convention, not a price — Nous ships `:free` slugs on a provider whose `freeTier` is false on @@ -1441,10 +1442,13 @@ function discoveredPricingRate(value: unknown): number | undefined { export function discoveredPricingStatus(item: ProviderModelsApiItem): "free" | "paid" | "unknown" { const pricing = plainRecord(item.pricing) ?? plainRecord(plainRecord(item.metadata)?.pricing); if (!pricing) return "unknown"; + const rates = Object.values(pricing).map(discoveredPricingRate); + if (rates.some(rate => rate !== undefined && rate > 0)) return "paid"; + if (rates.some(rate => rate === undefined)) return "unknown"; const prompt = discoveredPricingRate(pricing.prompt ?? pricing.input); const completion = discoveredPricingRate(pricing.completion ?? pricing.output); if (prompt === undefined || completion === undefined) return "unknown"; - return prompt === 0 && completion === 0 ? "free" : "paid"; + return "free"; } export function catalogHintsFromModelsApiItem(providerName: string, item: ProviderModelsApiItem): Partial { diff --git a/tests/codex-integration/catalog-free-pricing-status.test.ts b/tests/codex-integration/catalog-free-pricing-status.test.ts index 8fc0294d50..bc39467c86 100644 --- a/tests/codex-integration/catalog-free-pricing-status.test.ts +++ b/tests/codex-integration/catalog-free-pricing-status.test.ts @@ -44,6 +44,28 @@ describe("discovered model pricing classification (#3666)", () => { expect(discoveredPricingStatus({ id: "half2", pricing: { prompt: "1e-6", completion: "0" } })).toBe("paid"); }); + test("auxiliary charges prevent a model from classifying free", () => { + expect(discoveredPricingStatus({ + id: "request-charge", + pricing: { prompt: "0", completion: "0", request: "0.05" }, + })).toBe("paid"); + expect(discoveredPricingStatus({ + id: "free-all-dimensions", + pricing: { prompt: "0", completion: "0", request: 0, image: "0", web_search: "0.0" }, + })).toBe("free"); + }); + + test("unsupported auxiliary pricing stays unknown rather than classifying free", () => { + expect(discoveredPricingStatus({ + id: "unsupported-charge", + pricing: { prompt: 0, completion: 0, request: { amount: "0.05" } }, + })).toBe("unknown"); + expect(discoveredPricingStatus({ + id: "invalid-auxiliary", + pricing: { prompt: 0, completion: 0, image: -1 }, + })).toBe("unknown"); + }); + test("a provider that publishes no pricing is unknown, and the hint field is absent", () => { expect(discoveredPricingStatus({ id: "llama3.2" })).toBe("unknown"); // Absent rather than present-and-"unknown": catalogHintsFromModelsApiItem's contract is that