Skip to content

feat(settings): honor AI_PROVIDER / OPENAI_MODEL / ANTHROPIC_MODEL / MINIMAX_MODEL env overrides#77

Open
rafaelreis-r wants to merge 1 commit intoviperrcrypto:mainfrom
rafaelreis-r:pr/env-provider-overrides
Open

feat(settings): honor AI_PROVIDER / OPENAI_MODEL / ANTHROPIC_MODEL / MINIMAX_MODEL env overrides#77
rafaelreis-r wants to merge 1 commit intoviperrcrypto:mainfrom
rafaelreis-r:pr/env-provider-overrides

Conversation

@rafaelreis-r
Copy link
Copy Markdown
Contributor

Summary

Self-hosted deployments behind a compatible proxy (llama-swap, LiteLLM, Cloudflare AI Gateway, etc.) often need a model name that isn't in the upstream allow-list, and don't want a misclick in `/settings` to silently route requests to the wrong provider.

This PR makes four env vars win over the DB-stored values:

Env var Overrides
`AI_PROVIDER` `anthropic`/`openai`/`minimax` selection
`ANTHROPIC_MODEL` `anthropicModel` setting
`OPENAI_MODEL` `openaiModel` setting (escapes the curated allow-list)
`MINIMAX_MODEL` `minimaxModel` setting

When the env var is set, the cache lookup is skipped so the override takes effect immediately.

Test plan

  • Without env vars, behavior is unchanged (DB values still used)
  • With `AI_PROVIDER=openai`, `getProvider()` returns `openai` even if DB says `minimax`
  • With `OPENAI_MODEL=qwen35b`, `getOpenAIModel()` returns `qwen35b` regardless of `/settings` choice
  • Invalid `AI_PROVIDER` value falls through to DB (no crash)

🤖 Generated with Claude Code

…MINIMAX_MODEL env overrides

Self-hosted deployments behind a compatible proxy (llama-swap, LiteLLM,
Cloudflare AI Gateway, etc.) often need a model name that isn't in the
upstream allow-list, and don't want a misclick in /settings to silently
route requests to the wrong provider.

Make four env vars win over the DB-stored values:

- AI_PROVIDER       — anthropic | openai | minimax
- ANTHROPIC_MODEL   — overrides anthropicModel
- OPENAI_MODEL      — overrides openaiModel (escapes the model allow-list)
- MINIMAX_MODEL     — overrides minimaxModel

When the env var is set, the cache lookup is skipped, so the override
takes effect on every request without needing a process restart.

This is a behavior addition — existing users without the env vars set
see no change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant