You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`gemini`| Google |`google`|`google`| Key-in-URL auth for model list |
436
-
|`deepseek`| DeepSeek | — |`deepseek`||
437
-
|`mistral`| Mistral | — |`mistralai`||
438
-
|`moonshot`| Moonshot |`kimi`|`moonshotai`||
439
-
|`xai`| xAI | — |`xai`, `x-ai`||
440
-
|`minimax`| MiniMax | — |`minimax`||
441
-
|`qwen`| Alibaba |`alibaba`|`qwen`, `alibaba`||
442
-
|`zai`| Z.ai |`z.ai`|`z-ai`, `zhipuai`||
443
-
|`openrouter`| OpenRouter | — |`openrouter`| Public API, no key needed for model list |
444
-
|`ollama`| Ollama | — | — | Local only, no key needed |
430
+
**Do NOT duplicate the provider list here.** Read `PROVIDER_REGISTRY` in `common/constants/providers.ts` for the current list of supported providers, their IDs, aliases, and OpenRouter prefix mappings.
445
431
446
432
### Adding a New Provider
447
433
@@ -452,42 +438,41 @@ The registry exports derived maps used throughout the codebase:
452
438
453
439
### Model Discovery
454
440
455
-
Each provider's model list is fetched from **that provider's own API first**. If the native API fails or returns no models (some providers like MiniMax don't have a `/models` endpoint), the system falls back to building a model list from the OpenRouter pricing cache + OpenRouter pricing cache for that provider.
441
+
Each provider's model list is fetched from **that provider's own API first**. If the native API fails or returns no models (some providers like MiniMax don't have a `/models` endpoint), the system falls back to building a model list from the OpenRouter pricing cache for that provider.
456
442
457
443
```
458
444
User connects provider (POST /routing/:agent/providers)
→ if 0 models returned: buildFallbackModels() from OpenRouter cache + manual pricing
447
+
→ if 0 models returned: buildFallbackModels() from OpenRouter cache
462
448
→ ModelDiscoveryService.enrichModel()
463
449
→ looks up pricing from OpenRouter cache (PricingSyncService)
464
-
→ falls back to OpenRouter pricing cache for niche providers
465
450
→ computes quality score
466
451
→ saves to user_providers.cached_models (JSONB column)
467
452
→ recalculates tier assignments
468
453
```
469
454
470
455
-`ProviderModelFetcherService` — config-driven fetcher with parsers for each provider API format (OpenAI-compatible, Anthropic, Gemini, OpenRouter, Ollama)
471
-
-`ModelDiscoveryService` — orchestrator that decrypts keys, fetches, enriches with pricing, caches results. Falls back to OpenRouter + manual pricing when native API is unavailable.
456
+
-`ModelDiscoveryService` — orchestrator that decrypts keys, fetches, enriches with pricing, caches results. Falls back to OpenRouter cache when native API is unavailable.
472
457
-`cached_models` — per-provider, per-agent JSONB column on `user_providers` table
473
458
- Discovery runs synchronously on provider connect (user sees models immediately)
The `model_pricing` database table has been **dropped**. All pricing comes from a single source:
463
+
All pricing comes from a single source:
479
464
480
465
-**OpenRouter API** (public, no key needed, fetched daily via cron + on startup) — provides pricing for all providers. Stored in-memory by `PricingSyncService`. No hardcoded pricing data anywhere.
481
466
482
-
`ModelPricingCacheService`merges both sources and attributes models to their real provider using OpenRouter vendor prefixes (via `OPENROUTER_PREFIX_TO_PROVIDER`). Unsupported community vendors stay under "OpenRouter".
467
+
`ModelPricingCacheService`reads from the OpenRouter cache and attributes models to their real provider using OpenRouter vendor prefixes (via `OPENROUTER_PREFIX_TO_PROVIDER`). Unsupported community vendors stay under "OpenRouter".
483
468
484
-
**Priority order for model lists**: (1) Provider's native `/models` API, (2) OpenRouter cache filtered by vendor prefix, (3) Manual pricing reference. OpenRouter is the fallback, not the primary source. When a provider's native API works, its model list takes precedence.
469
+
**Priority order for model lists**: (1) Provider's native `/models` API, (2) OpenRouter cache filtered by vendor prefix. OpenRouter is the fallback, not the primary source. When a provider's native API works, its model list takes precedence.
485
470
486
471
### Where Models Appear
487
472
488
473
| Page | Source | What's shown |
489
474
|------|--------|-------------|
490
-
|**Model Prices**|`ModelPricingCacheService.getAll()`| All models from OpenRouter + manual pricing, attributed to real providers |
475
+
|**Model Prices**|`ModelPricingCacheService.getAll()`| All models from OpenRouter cache, attributed to real providers |
491
476
|**Routing (available models)**|`ModelDiscoveryService.getModelsForAgent()`| Only models from user's connected providers (discovered via native API) |
492
477
|**Routing (tier assignments)**|`TierAutoAssignService.recalculate()`| Auto-assigned from discovered models based on quality/price scoring |
493
478
|**Messages / Overview**| Stored in `agent_messages.model` column | Raw model name from telemetry, display name resolved via `model-display.ts` cache |
0 commit comments