Make LLM model configurable via MODEL environment variable #75

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

Context

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

Work

  • Add a MODEL environment variable (default: anthropic/claude-3.5-sonnet).
  • Read the variable in llm.py (or config.py) and pass it to the OpenRouter API call.
  • Update .env.example to document the variable and list a few example model IDs.
  • Log the active model at startup.

Acceptance Criteria

  • Setting MODEL=openai/gpt-4o causes the API to use GPT-4o for analysis.
  • When MODEL is unset, the default (anthropic/claude-3.5-sonnet) is used.
  • The active model is logged at INFO level on startup.
  • A unit test mocks the LLM call and verifies the model ID is read from config.

References

Roadmap: Backend — make LLM model configurable.

## Context `llm.py` hardcodes `anthropic/claude-3.5-sonnet`. Switching models requires a code change and rebuild. ## Work - Add a `MODEL` environment variable (default: `anthropic/claude-3.5-sonnet`). - Read the variable in `llm.py` (or `config.py`) and pass it to the OpenRouter API call. - Update `.env.example` to document the variable and list a few example model IDs. - Log the active model at startup. ## Acceptance Criteria - Setting `MODEL=openai/gpt-4o` causes the API to use GPT-4o for analysis. - When `MODEL` is unset, the default (`anthropic/claude-3.5-sonnet`) is used. - The active model is logged at INFO level on startup. - A unit test mocks the LLM call and verifies the model ID is read from config. ## References Roadmap: Backend — make LLM model configurable.
AI-Manager added the P2agent-readysmall labels 2026-03-26 14:22:28 +00:00
Author
Owner

Resolved. LLM model is configurable via MODEL environment variable, with per-analysis model selection also supported. Implemented in PR #29 and extended in PR #64 (both merged). See SPARC/config.py and SPARC/llm.py.

Resolved. LLM model is configurable via `MODEL` environment variable, with per-analysis model selection also supported. Implemented in PR #29 and extended in PR #64 (both merged). See `SPARC/config.py` and `SPARC/llm.py`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#75