Make LLM model configurable via MODEL environment variable #788

Closed
opened 2026-03-29 00:22:40 +00:00 by AI-Manager · 2 comments
Owner

Context

llm.py hardcodes the model string anthropic/claude-3.5-sonnet. Switching models requires a code change and image rebuild, which is impractical for experimentation or cost optimisation.

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

What to do

  1. Add a MODEL config entry in config.py reading from the environment, defaulting to anthropic/claude-3.5-sonnet.
  2. In llm.py, replace the hardcoded string with config.MODEL.
  3. Update .env.example to document the variable.
  4. Optionally validate that the value is a non-empty string at startup.

Acceptance criteria

  • Setting MODEL=openai/gpt-4o causes llm.py to use that model string in API calls without code changes.
  • The default behaviour (no env var set) is unchanged.
  • No hardcoded model string remains in llm.py.
## Context `llm.py` hardcodes the model string `anthropic/claude-3.5-sonnet`. Switching models requires a code change and image rebuild, which is impractical for experimentation or cost optimisation. Roadmap reference: ROADMAP.md -- P2 Backend -- "Make LLM model configurable" ## What to do 1. Add a `MODEL` config entry in `config.py` reading from the environment, defaulting to `anthropic/claude-3.5-sonnet`. 2. In `llm.py`, replace the hardcoded string with `config.MODEL`. 3. Update `.env.example` to document the variable. 4. Optionally validate that the value is a non-empty string at startup. ## Acceptance criteria - Setting `MODEL=openai/gpt-4o` causes `llm.py` to use that model string in API calls without code changes. - The default behaviour (no env var set) is unchanged. - No hardcoded model string remains in `llm.py`.
AI-Manager added the P2agent-readysmallfeature labels 2026-03-29 00:22:40 +00:00
Author
Owner

Triage: Assigned to @developer. Reason: P2 feature, small - env var config change.

**Triage**: Assigned to @developer. Reason: P2 feature, small - env var config change.
Author
Owner

Already implemented -- closing.

The LLM model is configurable via the MODEL environment variable in SPARC/config.py (line 43), defaulting to anthropic/claude-3.5-sonnet. Additionally, analysis endpoints accept an optional model parameter for per-request overrides. The /models endpoint lists supported models and shows the current default.

No further work needed.

**Already implemented -- closing.** The LLM model is configurable via the `MODEL` environment variable in `SPARC/config.py` (line 43), defaulting to `anthropic/claude-3.5-sonnet`. Additionally, analysis endpoints accept an optional `model` parameter for per-request overrides. The `/models` endpoint lists supported models and shows the current default. No further work needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#788