Add configurable LLM API URL and model allowlists - #9574
Conversation
Enables configuration of LLM provider, model, allowed models, and API base through environment variables. This makes it easier to switch or update LLM backends without code changes and improves support for non-OpenAI endpoints. Unit tests ensure correct handling and validation of custom LLM settings.
There was a problem hiding this comment.
Pull request overview
Adds environment-driven support for (1) custom LLM model allowlists and (2) custom OpenAI-compatible API base URLs, while keeping existing provider defaults when overrides are not configured. This primarily updates the API’s external LLM integration helpers and propagates new env vars into deployment templates/docs.
Changes:
- Extend
get_llm_config()to readLLM_MODELSandLLM_API_BASE, validate models against either provider defaults or the override list, and returnapi_base. - Pass
api_basethrough to the OpenAI client (base_url=...) inget_llm_response(). - Add unit tests and update CLI/AIO deployment env templates + docs to include the new configuration knobs.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| deployments/cli/community/variables.env | Adds LLM env knobs for CLI deployments (provider/model/models/api base). |
| deployments/cli/community/README.md | Documents new LLM env configuration and God Mode limitations for CLI deploy. |
| deployments/cli/community/docker-compose.yml | Wires LLM env vars into the shared app environment passed to services. |
| deployments/aio/community/variables.env | Adds LLM env knobs for AIO deployments. |
| deployments/aio/community/README.md | Documents new LLM env configuration for AIO deploy. |
| apps/api/plane/tests/unit/views/test_external_llm.py | Adds unit coverage for default vs overridden LLM config + API base handling. |
| apps/api/plane/app/views/external/base.py | Implements LLM_MODELS allowlist override and passes LLM_API_BASE to OpenAI client. |
| apps/api/.env.example | Adds LLM env knobs to backend env template. |
| .env.example | Adds LLM env knobs to root env template (alongside deprecated OpenAI/GPT vars). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughLLM configuration now supports model lists, optional API base URLs, model validation, and four-value error results. Integration endpoints pass the resolved API base URL to response generation. Deployment templates, documentation, and tests cover the new settings. ChangesLLM Configuration
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
LLM_API_KEY is now documented and included in example configs and deployment files for clarity. Handling of blank or unset LLM_MODELS and LLM_API_BASE has been improved to fall back gracefully to defaults, avoiding issues with empty overrides. Related documentation has been clarified to reflect these changes.
a46321f to
289288c
Compare
Enables configuration of custom LLM model allowlists and OpenAI-compatible API endpoints through environment variables. Existing provider and model behavior remains unchanged when the new variables are not set.
Description
LLM_MODELSas an optional comma-separated model allowlist.LLM_API_BASEfor custom OpenAI-compatible API endpoints.LLM_MODELSis empty.Example:
Type of Change
Screenshots and Media (if applicable)
Not applicable. The new settings are configured through environment variables and are not exposed in God Mode.
Test Scenarios
LLM_MODELSis unset.LLM_API_BASEis unset.LLM_API_BASEis passed to the OpenAI client.git diff --check.The full test suite was not run.
References
None.
Summary by CodeRabbit
New Features
Documentation