[recipes] Fix typed-edge-classifier model routing for OpenRouter - #374
Open
hadolphs wants to merge 1 commit into
Open
Conversation
|
Hey @hadolphs — welcome to Open Brain Source! 👋 Thanks for submitting your first PR. The automated review will run shortly and check things like metadata, folder structure, and README completeness. If anything needs fixing, the review comment will tell you exactly what. Once the automated checks pass, a human admin will review for quality and clarity. Expect a response within a few days. If you have questions, check out CONTRIBUTING.md or open an issue. |
The classifier defaults to Anthropic dated/dashed model names (claude-haiku-4-5-20251001, claude-opus-4-7). On OpenRouter resolveModel only added an 'anthropic/' prefix, producing slugs that 404 because OpenRouter uses dotted slugs (anthropic/claude-haiku-4.5, anthropic/claude-opus-4.7). Result: every filter/classify call failed with filter_error for the repo's recommended provider. Add an explicit OPENROUTER_MODEL_MAP in resolveModel so the shipped defaults route correctly out of the box. The Anthropic-direct path is unchanged (provider guard), and cost estimation is unaffected because estimateCost() is always called with the raw pre-resolve names that remain in PRICING. Docs updated to match.
hadolphs
force-pushed
the
contrib/hadolphs/typed-edge-classifier-openrouter-models
branch
from
September 3, 2026 00:20
24adf3f to
b233360
Compare
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.
Problem
recipes/typed-edge-classifier/classify-edges.mjsships with Anthropic's canonical model names as defaults (claude-haiku-4-5-20251001for the filter,claude-opus-4-7for classify). When the provider is OpenRouter — the recipe's recommended provider —resolveModel()only prependsanthropic/, producing slugs likeanthropic/claude-haiku-4-5-20251001that don't exist on OpenRouter. OpenRouter exposes these models under dotted slugs (anthropic/claude-haiku-4.5,anthropic/claude-opus-4.7).The result is that every Haiku-filter and Opus-classify call fails, so a default run writes nothing:
Fix
Add an explicit
OPENROUTER_MODEL_MAPand consult it inresolveModel()before falling back to the bareanthropic/prefix, mapping the names OB1 ships as defaults to their OpenRouter slugs.provider !== "openrouter".estimateCost()/assertPricingKnown()are always called with the raw, pre-resolve names, which remain keys inPRICING. NoPRICINGchanges and no default-model changes.Verification
With OpenRouter configured, the same run now classifies and writes edges:
Rows confirmed present in
public.thought_edges.