Skip to content

Keep the base URL path when verifying Anthropic routes - #192

Open
RaphaelFakhri wants to merge 1 commit into
vercel-labs:mainfrom
RaphaelFakhri:fix/anthropic-models-endpoint-base-path
Open

RaphaelFakhri wants to merge 1 commit into
vercel-labs:mainfrom
RaphaelFakhri:fix/anthropic-models-endpoint-base-path

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

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 test passes (pnpm test:unit: 61 files, 2384 tests passed)
  • pnpm lint passes
  • pnpm knip passes
  • 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.

@vercel

vercel Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

@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

auto-maintain Bot commented Oct 21, 2026

Copy link
Copy Markdown

🤖 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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Anthropic route verification drops the base URL path (new URL("/v1/models", baseUrl))

1 participant