Code Agent Anatomy (21): Extending from Scratch — Connecting a New LLM Provider
Description and use
Adding a new LLM provider to MyCodeAgent now requires only three steps: update the provider profile table, extend the type annotations, and add environment variables.
Problem
Adding a new LLM provider to MyCodeAgent was cumbersome, requiring multiple code changes and conditional logic.
Outcome
The framework now supports adding new LLM providers with minimal effort, eliminating code duplication and simplifying configuration.
Workflow
- 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
Evidence
Adding a new provider only requires three steps: Add a row to the table, Extend the type annotation, Configure environment variables
- Record date: 2026-09-11T17:00:54.308Z