feat(providers): OpenAI-compatible provider types as runtime data (providers.yaml)

Replace the five copy-paste OpenAI-compatible provider structs (moonshot,
moonshot_code, deepseek, zai, lm_studio) with one DeclaredProvider engine
driven by a providers.yaml catalog loaded at boot from the cwd — edit and
restart, no rebuild. The YAML carries identity, endpoints, per-model JSON
field mapping, id-glob enrichment rules and the reasoning knob (effort /
thinking request kinds); capability_flags keep vision and future input
modalities declarative. Anthropic, Ollama, OpenAI and OpenRouter stay
native (different wire protocols or bespoke parsing) and register
alongside; colliding declared ids are skipped. The shipped catalog is
validated by a unit test.
This commit is contained in:
2026-07-18 16:19:05 +01:00
parent 760dae06e5
commit 4fea04c57f
11 changed files with 1005 additions and 543 deletions
+1 -4
View File
@@ -1,11 +1,8 @@
pub mod anthropic;
pub mod deepseek;
pub mod lm_studio;
pub mod moonshot;
pub mod declared;
pub mod ollama;
pub mod openai;
pub mod openrouter;
pub mod zai;
// Re-export so existing code that uses `providers::ServiceType` / `providers::RemoteLlmModelInfo` keeps working.
pub use crate::provider::ServiceType;