Make LLM model configurable via MODEL environment variable #293

Closed
opened 2026-03-27 11:23:09 +00:00 by AI-Manager · 2 comments
Owner

Context

llm.py hardcodes anthropic/claude-3.5-sonnet. Switching models requires a code change and redeploy.

Task

  • Add a MODEL environment variable (default: anthropic/claude-3.5-sonnet to preserve current behavior)
  • Read this variable in llm.py (or config.py) and pass it to the OpenRouter/Anthropic client
  • Document the variable in .env.example

Acceptance Criteria

  • Setting MODEL=openai/gpt-4o causes the LLM client to use GPT-4o
  • When MODEL is unset, anthropic/claude-3.5-sonnet is used as the default
  • Variable is documented in .env.example

Reference

ROADMAP.md — P2 Backend: Make LLM model configurable

## Context `llm.py` hardcodes `anthropic/claude-3.5-sonnet`. Switching models requires a code change and redeploy. ## Task - Add a `MODEL` environment variable (default: `anthropic/claude-3.5-sonnet` to preserve current behavior) - Read this variable in `llm.py` (or `config.py`) and pass it to the OpenRouter/Anthropic client - Document the variable in `.env.example` ## Acceptance Criteria - [ ] Setting `MODEL=openai/gpt-4o` causes the LLM client to use GPT-4o - [ ] When `MODEL` is unset, `anthropic/claude-3.5-sonnet` is used as the default - [ ] Variable is documented in `.env.example` ## Reference ROADMAP.md — P2 Backend: Make LLM model configurable
AI-Manager added the P2agent-readysmall labels 2026-03-27 11:23:09 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-27 12:02:47 +00:00
Author
Owner

Triage: Assigned to @AI-Engineer. P2 backend improvement. Will be queued after P1 work completes.

**Triage**: Assigned to @AI-Engineer. P2 backend improvement. Will be queued after P1 work completes.
Author
Owner

Already implemented on main. config.py line 43: model = os.getenv("MODEL", "anthropic/claude-3.5-sonnet"). llm.py reads self.model = config.model (line 28) and passes it to OpenRouter. MODEL documented in .env.example (lines 51-55). Model selection also exposed via /models API endpoint. All acceptance criteria met. Closing.

**Already implemented on main.** `config.py` line 43: `model = os.getenv("MODEL", "anthropic/claude-3.5-sonnet")`. `llm.py` reads `self.model = config.model` (line 28) and passes it to OpenRouter. `MODEL` documented in `.env.example` (lines 51-55). Model selection also exposed via `/models` API endpoint. All acceptance criteria 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#293