Model / Provider Resolution
Goal: reduce implicit provider knowledge.
#Shared capability registry
src/llm/provider-capabilities.ts- required env per provider
- CLI default models
- auto CLI order
- document support
- streaming support
Source of truth for:
If a provider rule changes, update this file first.
#Auto model selection
src/model-auto.ts- resolve auto rules
- prepend CLI candidates
- map native candidates to OpenRouter when safe
- emit attempts with required env + transport
Responsibilities:
Keep it selection-focused. Do not add provider-specific capability branches there unless the registry cannot express them.
#Execution
src/llm/generate-text.ts- parse requested model id
- validate input shape
- route to provider transport
- normalize retries / fallbacks
Responsibilities:
Provider-specific SDK/http details belong under src/llm/providers/*.
#Error shaping
- access / model availability normalization stays provider-local when truly provider-specific
- generic capability errors should come from the shared registry
- unsupported functionality errors should be thrown before transport setup
#Rules
- add capability once; consume it in
model-autoandgenerate-text - keep provider env alias handling centralized
- keep default CLI model changes in the registry, not scattered tests/constants