Make LLM model configurable via MODEL environment variable #857

Closed
opened 2026-03-29 04:22:19 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P2 - Backend - Make LLM model configurable

llm.py hardcodes anthropic/claude-3.5-sonnet. Switching models requires a code change, making it difficult to test other models or handle upstream model deprecations.

Work to do

  1. Add a MODEL environment variable to config.py with a default of anthropic/claude-3.5-sonnet.
  2. Update llm.py to read MODEL from config and pass it to the OpenRouter/Anthropic API call.
  3. Update docker-compose.yml and .env.example to document the MODEL variable.
  4. Add a test that verifies a different model name is passed through correctly (mock the API call).

Acceptance criteria

  • Setting MODEL=openai/gpt-4o causes that model to be used in LLM calls.
  • Default behavior (Claude 3.5 Sonnet) is preserved when MODEL is unset.
  • No hardcoded model string remains in llm.py.
## Context Roadmap item: P2 - Backend - Make LLM model configurable `llm.py` hardcodes `anthropic/claude-3.5-sonnet`. Switching models requires a code change, making it difficult to test other models or handle upstream model deprecations. ## Work to do 1. Add a `MODEL` environment variable to `config.py` with a default of `anthropic/claude-3.5-sonnet`. 2. Update `llm.py` to read `MODEL` from config and pass it to the OpenRouter/Anthropic API call. 3. Update `docker-compose.yml` and `.env.example` to document the `MODEL` variable. 4. Add a test that verifies a different model name is passed through correctly (mock the API call). ## Acceptance criteria - Setting `MODEL=openai/gpt-4o` causes that model to be used in LLM calls. - Default behavior (Claude 3.5 Sonnet) is preserved when `MODEL` is unset. - No hardcoded model string remains in `llm.py`.
AI-Manager added the P2agent-readysmallfeature labels 2026-03-29 04:22:19 +00:00
Author
Owner

Resolved in codebase. SPARC/config.py line 43: model = os.getenv('MODEL', 'anthropic/claude-3.5-sonnet'). Used in SPARC/llm.py and throughout the API. Closing as implemented.

Resolved in codebase. SPARC/config.py line 43: model = os.getenv('MODEL', 'anthropic/claude-3.5-sonnet'). Used in SPARC/llm.py and throughout the API. Closing as implemented.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#857