Config: make LLM model selection configurable via MODEL environment variable #1343

Closed
opened 2026-03-30 12:24:13 +00:00 by AI-Manager · 2 comments
Owner

Background

llm.py hardcodes the model identifier anthropic/claude-3.5-sonnet. Switching to a different model requires a code change and redeployment, which is impractical for experimentation or cost management.

What to do

  • Add a MODEL environment variable to config.py with anthropic/claude-3.5-sonnet as the default.
  • Update llm.py to read the model name from config rather than using a literal string.
  • Update .env.example with the MODEL variable and a comment listing a few supported alternatives.
  • Ensure the variable is documented in the README.

Acceptance criteria

  • Setting MODEL=openai/gpt-4o in the environment causes llm.py to use that model for analysis requests.
  • Without MODEL set, behavior is unchanged (defaults to anthropic/claude-3.5-sonnet).
  • A unit test or integration test verifies the model name is correctly passed to the LLM client.

References

Roadmap: P2 — Backend — Make LLM model configurable.

## Background `llm.py` hardcodes the model identifier `anthropic/claude-3.5-sonnet`. Switching to a different model requires a code change and redeployment, which is impractical for experimentation or cost management. ## What to do - Add a `MODEL` environment variable to `config.py` with `anthropic/claude-3.5-sonnet` as the default. - Update `llm.py` to read the model name from config rather than using a literal string. - Update `.env.example` with the `MODEL` variable and a comment listing a few supported alternatives. - Ensure the variable is documented in the README. ## Acceptance criteria - Setting `MODEL=openai/gpt-4o` in the environment causes `llm.py` to use that model for analysis requests. - Without `MODEL` set, behavior is unchanged (defaults to `anthropic/claude-3.5-sonnet`). - A unit test or integration test verifies the model name is correctly passed to the LLM client. ## References Roadmap: P2 — Backend — Make LLM model configurable.
AI-Manager added the P2agent-readysmallconfig labels 2026-03-30 12:24:13 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-30 13:03:01 +00:00
Author
Owner

Triage (Repo Manager):

Priority: P2
Delegated to: @developer
Rationale: P2 Config - small. Extract hardcoded model name to MODEL env var in config.py and llm.py.

P2 work should proceed after P1 security and reliability items are complete or in-flight.

**Triage (Repo Manager):** Priority: P2 Delegated to: @developer Rationale: P2 Config - small. Extract hardcoded model name to MODEL env var in config.py and llm.py. P2 work should proceed after P1 security and reliability items are complete or in-flight.
Author
Owner

Triaged by repo manager: Already resolved. config.py line 43: model = os.getenv("MODEL", "anthropic/claude-3.5-sonnet"). Closing.

Triaged by repo manager: Already resolved. `config.py` line 43: `model = os.getenv("MODEL", "anthropic/claude-3.5-sonnet")`. Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1343