fix(ai): the OpenRouter fallback was a premium paid model - #135
Merged
Conversation
OPENROUTER_DEFAULT_MODEL was `anthropic/claude-sonnet-5`. OpenRouter is the FALLBACK here — it is reached when Groq's free tier is spent — so the failure mode of 'the free tier ran out' was not a degraded answer or an honest refusal. It was a bill, on a premium model, produced by the one code path nobody watches because it only runs when something else has already broken. A fallback is a reliability mechanism; paying is a business decision. Wiring the second to the first lets an outage make the decision at the worst moment, without anyone choosing it. It also broke the standing fleet rule that Anthropic is never a primary or fallback provider. Now `openai/gpt-oss-20b:free`, which reports pricing.prompt = 0 in OpenRouter's own catalogue (checked 2026-08-16) and was probed live for tool support on 2026-08-15. Guarded by a test, because this path is invisible in normal operation: the default must end in `:free` and must never be an Anthropic id. The rule mirrors `modelCost` in the shared ai-ration package — a routed id is free ONLY with the `:free` suffix, which is the entire difference between free routing and a per-call charge for identical weights. The same mistake was found in three apps on the same day (also kivvi and evig).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OPENROUTER_DEFAULT_MODELwasanthropic/claude-sonnet-5.OpenRouter is the fallback here — reached when Groq's free tier is spent. So the failure mode of "the free tier ran out" was not a degraded answer or an honest refusal. It was a bill, on a premium model, produced by the one code path nobody watches because it only runs when something else has already broken.
A fallback is a reliability mechanism; paying is a business decision. Wiring the second to the first lets an outage make the decision, at the worst possible moment, without anyone choosing it. It also broke the standing fleet rule that Anthropic is never a primary or fallback provider.
Now
openai/gpt-oss-20b:free—pricing.prompt = 0in OpenRouter's own catalogue (checked 2026-08-16), probed live for tool support 2026-08-15.Guarded, because the path is invisible
A test now pins that the default ends in
:freeand is never an Anthropic id. The rule mirrorsmodelCostin the sharedai-rationpackage: a routed id is free only with the:freesuffix — the entire difference between free routing and a per-call charge for identical weights.The same mistake was found in three apps on the same day (also kivvi and evig), which is why the rule now lives in a shared package rather than in three review comments.
🤖 Generated with Claude Code