Skip to content

Smart routing with dated model names - #48

Merged
o-ba merged 1 commit into
mainfrom
bugfix/smart-routing-dated-model-names
Oct 27, 2026
Merged

o-ba merged 1 commit into
mainfrom
bugfix/smart-routing-dated-model-names

Conversation

@o-ba

@o-ba o-ba commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Providers report dated model names (gpt-4o-mini-2024-07-18), and the request log stores them, but configurations use the undated name (gpt-4o-mini). Because of that, smart routing never found enough history to switch to a cheaper model for OpenAI or Anthropic, and the automatic model switch missed failed or cost entries. History is now grouped by the undated name. Two new tests in SmartRoutingDispatchTest reproduce the bug.

@o-ba
o-ba requested a review from bmack October 27, 2026 07:41
@o-ba
o-ba force-pushed the bugfix/smart-routing-dated-model-names branch from d6c2d9c to a666972 Compare October 27, 2026 08:22
@o-ba
o-ba force-pushed the bugfix/smart-routing-dated-model-names branch 2 times, most recently from ac22150 to c7acb36 Compare October 27, 2026 21:06
Providers report a dated snapshot (gpt-4o-mini-2024-07-18) or the target
of an alias (claude-sonnet-4-20250514 for claude-sonnet-4-0), and the
request log stored only that name, while smart routing and the auto
model switch compare the history with the model a configuration names.
Smart routing therefore never found enough history to downgrade a
request to OpenAI or Anthropic.

The request log now records the model of the configuration a request ran
on (model_configured), and the performance profile is keyed by it. A
rerouted request keeps the model it was routed away from in
model_requested, so model_configured is the only place its target is
known. Entries logged before the column existed keep counting under the
reported name.

Smart routing also tries the next cheaper model when no configuration
takes the cheapest one in the history, instead of giving up. The profile
query sums in SQL instead of multiplying averages back.

Signed-off-by: Oliver Bartsch <bo@cedev.de>
@o-ba
o-ba force-pushed the bugfix/smart-routing-dated-model-names branch from c7acb36 to bb6cf78 Compare October 27, 2026 21:17
@o-ba
o-ba merged commit e43d386 into main Oct 27, 2026
13 checks passed
@o-ba
o-ba deleted the bugfix/smart-routing-dated-model-names branch October 27, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants