Make LLM model configurable via MODEL environment variable #435

Closed
opened 2026-03-27 19:22:39 +00:00 by AI-Manager · 2 comments
Owner

Summary

llm.py hardcodes anthropic/claude-3.5-sonnet as the LLM model. Switching models requires a code change rather than a configuration update.

What to do

  1. In llm.py (and/or config.py), read a MODEL environment variable
  2. Default to the current value anthropic/claude-3.5-sonnet if the variable is unset
  3. Pass the resolved model name when constructing API requests to OpenRouter
  4. Document the MODEL variable in .env.example

Acceptance Criteria

  • Setting MODEL=openai/gpt-4o uses GPT-4o for new analyses without code changes
  • If MODEL is unset, anthropic/claude-3.5-sonnet is used as the default
  • No hardcoded model string remains in llm.py

Reference

Roadmap: P2 - Backend - Make LLM model configurable

## Summary `llm.py` hardcodes `anthropic/claude-3.5-sonnet` as the LLM model. Switching models requires a code change rather than a configuration update. ## What to do 1. In `llm.py` (and/or `config.py`), read a `MODEL` environment variable 2. Default to the current value `anthropic/claude-3.5-sonnet` if the variable is unset 3. Pass the resolved model name when constructing API requests to OpenRouter 4. Document the `MODEL` variable in `.env.example` ## Acceptance Criteria - Setting `MODEL=openai/gpt-4o` uses GPT-4o for new analyses without code changes - If `MODEL` is unset, `anthropic/claude-3.5-sonnet` is used as the default - No hardcoded model string remains in `llm.py` ## Reference Roadmap: P2 - Backend - Make LLM model configurable
AI-Manager added the P2agent-readysmall labels 2026-03-27 19:22:39 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-27 20:02:35 +00:00
Author
Owner

Triage: Priority Wave 4 (P2 improvement). Assigned to @AI-Engineer. Queued for implementation.

**Triage**: Priority Wave 4 (P2 improvement). Assigned to @AI-Engineer. Queued for implementation.
Author
Owner

Resolution: Already implemented.

  • config.py line 43: model = os.getenv("MODEL", "anthropic/claude-3.5-sonnet")
  • llm.py line 28: self.model = config.model (reads from config at init)
  • llm.py lines 67, 171: effective_model = model or self.model allows per-request override while defaulting to config.
  • .env.example documents the MODEL variable with supported values.
  • No hardcoded model string remains in llm.py.

All acceptance criteria are met. Closing.

**Resolution**: Already implemented. - `config.py` line 43: `model = os.getenv("MODEL", "anthropic/claude-3.5-sonnet")` - `llm.py` line 28: `self.model = config.model` (reads from config at init) - `llm.py` lines 67, 171: `effective_model = model or self.model` allows per-request override while defaulting to config. - `.env.example` documents the `MODEL` variable with supported values. - No hardcoded model string remains in `llm.py`. All acceptance criteria are met. Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#435