fix(model-connections): use OpenAI-compatible base URL verbatim and deprecate raw provider - #1641
Conversation
|
@AnishSarkar22 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
…enAI-compatible models
…n with updated URL processing
… in status change notifications
…ndpoint to require session context
Description
/v1, matching how LiteLLM and the OpenAI SDK treatapi_base.ensure_v1helper entirely;to_litellmnow only special-cases Anthropic (strips a trailing/v1so LiteLLM's native handler doesn't produce/v1/v1/messages) and passes every other provider's base URL through verbatim./v1, so real-world behavior is unchanged, but the path is no longer forced.{base_url}/modelsexactly as entered for discovery and verification.openai_compatible_raw: hidden from the provider catalog so it can no longer be added, while kept in the registry so pre-existing connections still resolve and work; the mergedopenai_compatible(now verbatim) covers the former raw use case./v1), dropping the separate raw-endpoint guidance and the endpoint preview.ensure_v1assertions and add coverage that a bare host is not rewritten with/v1and that custom paths (e.g./api/v3) are preserved./v1) and lead 404 troubleshooting with a check that the base URL contains/v1.openai_compatibleconnections, which fail loudly and are fixed by adding/v1to the URL.Motivation and Context
FIX #
Screenshots
API Changes
Change Type
Testing Performed
Checklist
High-level PR Summary
This PR changes how OpenAI-compatible base URLs are handled throughout the system. Previously, the system would automatically append
/v1to base URLs; now the URL is used exactly as entered by the user. Theopenai_compatible_rawprovider is deprecated (hidden from the catalog but kept for backward compatibility), as the mainopenai_compatibleprovider now handles both standard and custom paths. Special handling for Anthropic (stripping version suffixes) and fixed endpoints like OpenRouter/Requesty (which still append/v1) are preserved. The UI, documentation, and tests are updated to reflect that users must include/v1in their base URLs when needed.⏱️ Estimated Review Time: 5-15 minutes
💡 Review Order Suggestion
surfsense_backend/app/services/provider_registry.pysurfsense_backend/app/services/model_resolver.pysurfsense_backend/app/services/model_connection_service.pysurfsense_backend/tests/unit/services/test_model_connections.pysurfsense_backend/app/routes/model_connections_routes.pysurfsense_web/components/settings/model-connections/default-connect-form.tsxsurfsense_web/content/docs/local-models/lm-studio.mdxsurfsense_web/content/docs/local-models/other-local-servers.mdx