添加 Provider
当 Anyy 需要新的 model transport 或 provider-specific auth/catalog behavior 时才添加 provider。如果 wire API 已存在,优先添加 provider profile。
Provider Interface
Provider adapters 在 agent.LLMProvider 后面实现 runtime path。通用 provider types 和 config 位于
internal/llm;setup templates 位于 internal/providerprofiles。
不要从 gateway、TUI、dashboard 或 channels 直接调用 provider SDK。
请求转换
Request conversion 把 agent.LLMRequest messages、tools、metadata 和 overlays 映射为 provider wire format。
Provider-specific prompt adaptation 应留在 provider runtime request copy 中。不要 mutate stored session messages。
Streaming 转换
Streaming conversion 把 provider events 映射为 agent.LLMStreamEvent values。Loop 期望完整 tool calls
和稳定 finish reasons。
Provider adapters 负责组装 partial tool-call arguments,并在 provider 暴露时映射 usage/rate-limit fields。
能力
为 streaming、tool calls、JSON/schema support、context window、output limit、multimodal input、video input、reasoning、prompt cache、usage metadata 和 credential refresh 声明 capabilities。
Fallback compatibility 依赖这些值。
目录元数据
Provider templates 定义 display name、support level、API mode、default base URL、auth choices、catalog policy、default model、endpoint variants 和 fallback model suggestions。
Setup 和 dashboard 页面读取这些 metadata。文案应面向用户,并避免嵌入 secrets 或 private endpoints。
健康检查
Provider health 和 verification 应通过 provider runtime 分类 errors:auth、quota、rate limit、overload、 timeout、context overflow、model not found、payload too large、response format 和 unknown。
Tests 应覆盖 request conversion、streaming conversion、error classification、capability defaults、fallback 和 setup template output。