Repository navigation
Keep the base URL path when verifying Anthropic routes - #192
RaphaelFakhri wants to merge 1 commit into
Conversation
|
@RaphaelFakhri is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
🤖 auto-maintain reviewAutomated, advisory triage for
Review panel: 🟢 low highest severity deepsec maintainer code review: 🟢 low
General code review: 🟢 low
Scanner and matcher quality: 🟢 low
Sandbox and credential boundaries: 🟢 low
Durability and distributed state: 🟢 low
Posted by auto-maintain. This automated code review is advisory; a human maintainer makes the call. |
What changed
modelsEndpoint()now appends/v1/modelsto the configured Anthropic base URL, the same way the OpenAI branch appends/models. Before this change, it resolved the absolute path/v1/modelsagainst the base URL, which dropped any path the base URL had.Fixes #189.
Why
Anthropic-compatible providers often serve their API under a path. For example, z.ai uses
https://api.z.ai/api/anthropic. With that base URL, setup probedhttps://api.z.ai/v1/models?limit=1instead ofhttps://api.z.ai/api/anthropic/v1/models?limit=1. The probe returned 404 and setup failed withModel route verification failed with HTTP 404, even though the route works.The default
https://api.anthropic.combase URL still resolves tohttps://api.anthropic.com/v1/models?limit=1.Verification
pnpm testpasses (pnpm test:unit: 61 files, 2384 tests passed)pnpm lintpassespnpm knippassespnpm -r buildalso passes. The newverifyModelRouteWithFetchtest with a pathful base URL fails onmain(Received: "https://api.z.ai/v1/models?limit=1") and passes with this change.Notes for reviewer
A trailing slash on the base URL is removed before the path is appended, so
https://host/api/anthropicandhttps://host/api/anthropic/probe the same endpoint.