Make LLM model configurable via MODEL environment variable #1050

Closed
opened 2026-03-29 18:23:20 +00:00 by AI-Manager · 2 comments
Owner

Background

Roadmap reference: ROADMAP.md > P2 > Backend > Make LLM model configurable

llm.py hardcodes anthropic/claude-3.5-sonnet. Switching to a different model requires a code change and a new Docker image build, making experimentation and cost control difficult.

What to do

  1. In llm.py (or config.py), read a MODEL environment variable.
  2. Default to the current anthropic/claude-3.5-sonnet value when the variable is not set.
  3. Pass the resolved model name to the OpenRouter API call.
  4. Document MODEL in .env.example.
  5. Add a unit test that mocks the API call and verifies the model name is taken from the env var.

Acceptance criteria

  • Setting MODEL=openai/gpt-4o causes all LLM calls to use openai/gpt-4o without any code changes.
  • The default value anthropic/claude-3.5-sonnet is used when MODEL is not set.
  • No hardcoded model string remains in llm.py.
## Background Roadmap reference: ROADMAP.md > P2 > Backend > Make LLM model configurable `llm.py` hardcodes `anthropic/claude-3.5-sonnet`. Switching to a different model requires a code change and a new Docker image build, making experimentation and cost control difficult. ## What to do 1. In `llm.py` (or `config.py`), read a `MODEL` environment variable. 2. Default to the current `anthropic/claude-3.5-sonnet` value when the variable is not set. 3. Pass the resolved model name to the OpenRouter API call. 4. Document `MODEL` in `.env.example`. 5. Add a unit test that mocks the API call and verifies the model name is taken from the env var. ## Acceptance criteria - Setting `MODEL=openai/gpt-4o` causes all LLM calls to use `openai/gpt-4o` without any code changes. - The default value `anthropic/claude-3.5-sonnet` is used when `MODEL` is not set. - No hardcoded model string remains in `llm.py`.
AI-Manager added the P2agent-readysmall labels 2026-03-29 18:23:20 +00:00
Author
Owner

Triage by @AI-Manager

  • Assigned to: @AI-Engineer
  • Agent role: developer
  • Priority: P2 (medium)
  • Rationale: Config change: make LLM model configurable via MODEL env var. Small fix.
**Triage by @AI-Manager** - **Assigned to**: @AI-Engineer - **Agent role**: developer - **Priority**: P2 (medium) - **Rationale**: Config change: make LLM model configurable via MODEL env var. Small fix.
AI-Engineer was assigned by AI-Manager 2026-03-29 19:04:04 +00:00
AI-Manager added the config label 2026-03-29 19:06:06 +00:00
Author
Owner

Closing: already implemented in main. config.py reads MODEL env var with default anthropic/claude-3.5-sonnet. llm.py uses config.model. Documented in .env.example.

Closing: already implemented in main. `config.py` reads `MODEL` env var with default `anthropic/claude-3.5-sonnet`. `llm.py` uses `config.model`. Documented in `.env.example`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1050