mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-25 19:20:16 +00:00
064d14c85b
PR #1762 fixed the rsplit grammar collision for plain @openrouter:model:free qualifiers, but skipped the fallback whenever the provider hint started with 'custom:' on the assumption that custom providers route directly. That left '@custom:my-key:some-model:free' broken: rsplit yields provider='custom:my-key:some-model', bare='free' → custom guard skips the split-fallback → returns provider='custom:my-key:some-model', model='free'. Detect the over-split structurally instead of using a known-suffix allowlist: custom hints carry exactly one segment after 'custom:' (constructed at api/config.py:1363 as 'custom:' + entry_name). So any rsplit result of 'custom:<a>:<b>' with bare model '<c>' has eaten one model segment — peel it back with a second rsplit and prepend it to the bare model. This is robust for :free / :beta / :thinking / :preview / any future OpenRouter suffix without an allowlist to maintain. Adds 5 regression tests covering the matrix (free/beta/thinking/preview/ slashed-model). All 7 existing #1744 tests still pass; #1228 tests unaffected. Co-authored-by: Cake <51058514+Sanjays2402@users.noreply.github.com>