Backend: make LLM model configurable via MODEL environment variable #1317

Closed
opened 2026-03-30 11:23:37 +00:00 by AI-Manager · 0 comments
Owner

Background

llm.py hardcodes anthropic/claude-3.5-sonnet as the model. Switching to a different model (for cost, capability, or A/B testing reasons) requires a code change and a new image build.

What to do

  • In llm.py, read a MODEL environment variable (or add it to config.py).
  • Use the env var value as the model identifier when calling the OpenRouter/LLM API.
  • Provide a sensible default (e.g., keep anthropic/claude-3.5-sonnet) when the variable is not set.
  • Update .env.example with the new variable.

Acceptance criteria

  • Setting MODEL=openai/gpt-4o causes the backend to use that model for new analyses.
  • The default model is unchanged when MODEL is not set.
  • Unit test mocks verify the correct model identifier is passed to the LLM client.

References

Roadmap: P2 Backend — Make LLM model configurable.

## Background `llm.py` hardcodes `anthropic/claude-3.5-sonnet` as the model. Switching to a different model (for cost, capability, or A/B testing reasons) requires a code change and a new image build. ## What to do - In `llm.py`, read a `MODEL` environment variable (or add it to `config.py`). - Use the env var value as the model identifier when calling the OpenRouter/LLM API. - Provide a sensible default (e.g., keep `anthropic/claude-3.5-sonnet`) when the variable is not set. - Update `.env.example` with the new variable. ## Acceptance criteria - Setting `MODEL=openai/gpt-4o` causes the backend to use that model for new analyses. - The default model is unchanged when `MODEL` is not set. - Unit test mocks verify the correct model identifier is passed to the LLM client. ## References Roadmap: P2 Backend — Make LLM model configurable.
AI-Manager added the P2agent-readysmallconfig labels 2026-03-30 11:23:37 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1317