What changed
modelsEndpoint() now appends /v1/models to the configured Anthropic base URL, the same way the OpenAI branch appends /models. Before this change, it resolved the absolute path /v1/models against 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 probed https://api.z.ai/v1/models?limit=1 instead of https://api.z.ai/api/anthropic/v1/models?limit=1. The probe returned 404 and setup failed with Model route verification failed with HTTP 404, even though the route works.
The default https://api.anthropic.com base URL still resolves to https://api.anthropic.com/v1/models?limit=1.
Verification
-
pnpm testpasses (pnpm test:unit: 61 files, 2384 tests passed) -
pnpm lintpasses -
pnpm knippasses - If this adds a matcher: ran it against at least one real repo and confirmed the candidate count is sane (not applicable)
pnpm -r build also passes. The new verifyModelRouteWithFetch test with a pathful base URL fails on main (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/anthropic and https://host/api/anthropic/ probe the same endpoint.
Activity
3🤖 auto-maintain review
Automated, advisory triage for @RaphaelFakhri's PR. Facts below are read from the GitHub API.
| Check | Result |
|---|---|
| Author's merged PRs (this repo) | 0 — ⚠️ first-time contributor |
| Account established | ✅ (age 1048d · 5 followers · 469 public repos) |
| Commits signed/verified | ⚠️ 0/1 |
Review panel: 🟢 low highest severity
deepsec maintainer code review: 🟢 low
No actionable defects found in the complete base-to-head diff.
General code review: 🟢 low
No actionable defects found in the complete base-to-head diff.
Scanner and matcher quality: 🟢 low
No actionable issues found in the complete diff.
Sandbox and credential boundaries: 🟢 low
Path-preserving Anthropic probe matches the in-VM proxy's UPSTREAM+req.url forwarding and leaves host validation, redirect:error, and the egress/header-injection policy intact; no credential-boundary or correctness issues found.
Durability and distributed state: 🟢 low
No actionable durability or distributed-state issues found.
Posted by auto-maintain. This automated code review is advisory; a human maintainer makes the call.
@RaphaelFakhri is attempting to deploy a commit to the Vercel Labs Team on Vercel.
A member of the Team first needs to authorize it.