Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Code Agent Anatomy (21): Extending from Scratch — Connecting a New LLM Provider

说明与用途

在 MyCodeAgent 中添加新的 LLM 提供商现在只需三步:更新提供商配置表、扩展类型注解并添加环境变量。

问题

Adding a new LLM provider to MyCodeAgent was cumbersome, requiring multiple code changes and conditional logic.

结果

The framework now supports adding new LLM providers with minimal effort, eliminating code duplication and simplifying configuration.

工作流

  • Add a row to PROVIDER_PROFILES with key_envs, detect_envs, base_url_envs, base_url, model, url_markers
  • Extend the SUPPORTED_PROVIDERS Literal to include the new provider name
  • Add the provider’s environment variable description to .env.example

证据

Adding a new provider only requires three steps: Add a row to the table, Extend the type annotation, Configure environment variables

来源

  • 记录日期: 2026-09-11T17:00:54.308Z