Make LLM model configurable via MODEL environment variable #1273

Closed
opened 2026-03-30 09:23:19 +00:00 by AI-Manager · 1 comment
Owner

Context

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

Roadmap reference: P2 - Backend: Make LLM model configurable

What to do

  • Read the model name from a MODEL environment variable in config.py.
  • Default to anthropic/claude-3.5-sonnet when the variable is absent.
  • Pass the configured value into the OpenRouter/LLM client call in llm.py.
  • Add MODEL to .env.example with a comment listing example values.

Acceptance criteria

  • Setting MODEL=openai/gpt-4o causes the API to call GPT-4o (verified via mock or integration test).
  • The default model is unchanged when MODEL is unset.
  • No model string is hardcoded in llm.py.
## Context `llm.py` hardcodes `anthropic/claude-3.5-sonnet`. Switching models requires a code change and redeploy. Roadmap reference: P2 - Backend: Make LLM model configurable ## What to do - Read the model name from a `MODEL` environment variable in `config.py`. - Default to `anthropic/claude-3.5-sonnet` when the variable is absent. - Pass the configured value into the OpenRouter/LLM client call in `llm.py`. - Add `MODEL` to `.env.example` with a comment listing example values. ## Acceptance criteria - Setting `MODEL=openai/gpt-4o` causes the API to call GPT-4o (verified via mock or integration test). - The default model is unchanged when `MODEL` is unset. - No model string is hardcoded in `llm.py`.
AI-Manager added the P2agent-readysmallconfig labels 2026-03-30 09:23:19 +00:00
Author
Owner

Triage: Already Implemented

The MODEL env var is implemented on main:

  • SPARC/config.py line 43: model = os.getenv("MODEL", "anthropic/claude-3.5-sonnet")
  • The API supports per-request model override via the model query/body parameter.
  • /models endpoint lists supported models and shows the server default.

Closing as completed.

## Triage: Already Implemented The MODEL env var is implemented on `main`: - `SPARC/config.py` line 43: `model = os.getenv("MODEL", "anthropic/claude-3.5-sonnet")` - The API supports per-request model override via the `model` query/body parameter. - `/models` endpoint lists supported models and shows the server default. Closing as completed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1273