Model identifier
Provider ID if detected, null otherwise
detectProviderByModel('gpt-4-turbo'); // 'openai'
detectProviderByModel('claude-3-opus'); // 'anthropic'
detectProviderByModel('grok-2'); // 'xai'
detectProviderByModel('anthropic/claude-opus-4'); // 'openrouter' (slash notation)
detectProviderByModel('openai/gpt-4o'); // 'openrouter' (slash notation)
detectProviderByModel('meta-llama/llama-3.1-8b'); // 'openrouter' (slash notation)
detectProviderByModel('Qwen3-4B-MLX'); // null (unknown → local fallback)
Detect provider from a model name using signature matching.
Detection priority (first match wins):
/— OpenRouter uses org/model notation (e.g. "anthropic/claude-opus-4", "meta-llama/llama-3.1-8b"). This check runs BEFORE signature matching so that e.g. "anthropic/claude-opus-4" routes to OpenRouter, not the native Anthropic API.