fix: use GET /v1/models for Anthropic connection test - #106
Conversation
The setup wizard's connection test sent GET to /v1/messages which only accepts POST, causing a 405 error. Anthropic's /v1/models endpoint supports GET and is the correct endpoint for testing connectivity. Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical issue in the setup wizard where Anthropic provider connection tests failed due to an incorrect API endpoint. By switching the test endpoint from '/v1/messages' to '/v1/models', the system now correctly verifies Anthropic API keys and endpoints, preventing '405 Method Not Allowed' errors and ensuring a smoother setup experience for users integrating Anthropic services. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Automated approval for solo maintainer project
This PR has passed all automated quality gates:
- ✅ Static analysis (PHPStan)
- ✅ Code style (PHP-CS-Fixer)
- ✅ Unit & functional tests
- ✅ Security scanning
- ✅ Dependency review
See SECURITY_CONTROLS.md for compensating controls documentation.
There was a problem hiding this comment.
Code Review
This pull request fixes a connection test issue for Anthropic providers by changing the test endpoint from "/v1/messages" to "/v1/models". However, the "testConnection" method remains vulnerable to Server-Side Request Forgery (SSRF) and potential API key leakage because it uses an unvalidated user-provided endpoint URL. It is recommended to implement strict URL validation for the provider endpoint. Additionally, I've suggested a refactoring of the endpoint selection logic to improve code clarity and address a similar inconsistency for the "groq" provider.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #106 +/- ##
=========================================
Coverage 92.48% 92.48%
Complexity 1937 1937
=========================================
Files 77 77
Lines 6849 6849
=========================================
Hits 6334 6334
Misses 515 515
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Fixes the Setup Wizard’s Anthropic connection test by switching the probe endpoint from GET /v1/messages (invalid; POST-only) to GET /v1/models (valid), aligning Anthropic with the “list models” style checks used for other providers.
Changes:
- Update Anthropic connection test endpoint to
.../v1/modelsto avoid 405 responses.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
The setup wizard's connection test for Anthropic providers sent
GET /v1/messages, which only acceptsPOST, causing a 405 Method Not Allowed error.Changed to
GET /v1/modelswhich Anthropic supports and is consistent with how other providers (OpenAI, Gemini) are tested.Related
Related to #98 (wizard endpoint URL issues)