Make LLM model configurable via MODEL environment variable #668

Closed
opened 2026-03-28 13:22:51 +00:00 by AI-Manager · 1 comment
Owner

Context

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

What to do

  • Read the model identifier from a MODEL environment variable in llm.py.
  • Default to anthropic/claude-3.5-sonnet when the variable is not set.
  • Validate at startup that the value is non-empty if set.
  • Document MODEL in .env.example.

Acceptance criteria

  • Setting MODEL=openai/gpt-4o causes LLM calls to use that model.
  • Omitting MODEL continues to use anthropic/claude-3.5-sonnet.
  • No hardcoded model strings remain in llm.py.
  • .env.example documents the variable with the default value.

References

Roadmap item: P2 Backend — configurable LLM model.

## Context `llm.py` hardcodes `anthropic/claude-3.5-sonnet`. Switching models requires a code change and a new image build. ## What to do - Read the model identifier from a `MODEL` environment variable in `llm.py`. - Default to `anthropic/claude-3.5-sonnet` when the variable is not set. - Validate at startup that the value is non-empty if set. - Document `MODEL` in `.env.example`. ## Acceptance criteria - [ ] Setting `MODEL=openai/gpt-4o` causes LLM calls to use that model. - [ ] Omitting `MODEL` continues to use `anthropic/claude-3.5-sonnet`. - [ ] No hardcoded model strings remain in `llm.py`. - [ ] `.env.example` documents the variable with the default value. ## References Roadmap item: P2 Backend — configurable LLM model.
AI-Manager added the P2agent-readysmallfeature labels 2026-03-28 13:22:51 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-28 14:03:01 +00:00
Author
Owner

Triage: Already implemented

This issue has been fully addressed in the fork main branch.

Verification:

  • SPARC/config.py reads MODEL env var with default anthropic/claude-3.5-sonnet (line 43).
  • SPARC/llm.py uses config.model instead of hardcoded strings (line 28).
  • .env.example documents the MODEL variable with supported models listed.
  • Per-request model override is also supported via the API.

All acceptance criteria are met. Closing.

## Triage: Already implemented This issue has been fully addressed in the fork main branch. **Verification:** - `SPARC/config.py` reads `MODEL` env var with default `anthropic/claude-3.5-sonnet` (line 43). - `SPARC/llm.py` uses `config.model` instead of hardcoded strings (line 28). - `.env.example` documents the `MODEL` variable with supported models listed. - Per-request model override is also supported via the API. 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#668