Skip to content

Feature: scoped auto model (provider + pattern) #251

Closed

Description

@DevGuyRash

@TUGOhost

The new auto model selection is great, but right now it picks the newest available model globally. Please add a way to scope auto by provider/handler and by name pattern so we can target “latest that matches X”.

Proposed syntax (back‑compat):

  • auto:<glob-or-regex> → newest model whose alias/upstream name matches (e.g., auto:gpt-5* or auto:/^gpt-5/).
  • auto@<provider>:<pattern> → restrict to a specific OpenAI‑compat provider name from config (e.g., auto@openrouter:gpt-5*).
  • auto#<handler>:<pattern> → restrict to handler type (openai|claude|gemini|codex), e.g. auto#openai:gpt-5-codex.

Resolution rules (minimal):

  1. Filter registry by optional handler and/or provider,
  2. Filter by name match (glob or regex),
  3. Sort by created desc (current behavior),
  4. Pick first available model,
  5. If nothing matches, fall back to current global auto (to remain backward compatible).

Implementation sketch:

  • Extend ResolveAutoModel() to parse the string form and call a new GetFirstAvailableModelWithFilter(handler string, provider string, match func(string) bool) built on the existing registry/get‑providers helpers.

Why: Keeps the simplicity of auto while letting users pin to a family (e.g., gpt-5*) and/or a provider without hardcoding exact model names.

refs: initial auto commit and PR (v6.3.35). (GitHub)


(Optional) “better idea” if you want to suggest an alternative

If you’re open to a small API extension (while keeping the string form above), consider supporting an auxiliary selector field that many clients will ignore safely:

{
  "model": "auto",
  "x-router": { "provider": "openrouter", "match": "gpt-5*", "regex": false, "handler": "openai" }
}

The proxy can read x-router (or router) server‑side without breaking OpenAI‑compatible clients; if absent, fall back to parsing model as proposed above. This keeps the model string clean and gives structured knobs for UIs and power users. (The underlying selection still sorts by created, same as the current auto implementation.) (GitHub)

Activity

  1. locked and limited conversation to collaborators on Dec 14, 2025
  2. converted this issue into a discussion #524 on Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions