A doubled API path — most often seen as /v1/v1/chat/completions followed by a 404 page not found response — happens when a client appends a versioned endpoint path to a base URL that already ends in /v1. The practical fix is to normalize the base URL before composing the request: strip any trailing slash and a single trailing /v1, then append the endpoint path. This article explains why the problem appears in local AI connectors, how to confirm it is the cause, and how to fix it whether you are editing a setting or patching connector code.
Two public bug reports illustrate the pattern. In the VMark project, the app appends /v1/chat/completions, /v1/models, and /v1/messages to the base URL configured for an OpenAI- or Anthropic-compatible REST provider. Because most providers publish their base URL with /v1 already included, a URL entered as https://host/v1 becomes https://host/v1/v1/chat/completions, which the server rejects with 404 page not found (VMark issue #1084). A separate report in NVIDIA-NeMo Guardrails describes the same failure in ModelEngine._prepare_request(), where a user-supplied base_url ending in /v1 produced /v1/v1/chat/completions and a 404 from the upstream server (Guardrails issue #1862).
What a doubled path actually means
An OpenAI-compatible HTTP API is addressed in two parts: a base URL that identifies the host and version prefix, and an endpoint path that identifies the operation. In a correct request, those two parts join once:
base URL: https://api.example.com/v1
endpoint path: /chat/completions
final URL: https://api.example.com/v1/chat/completions
The failure occurs when the client assumes the base URL does not contain the version segment. It appends the full versioned path, so the version appears twice:
base URL: https://api.example.com/v1
appended path: /v1/chat/completions
final URL: https://api.example.com/v1/v1/chat/completions
Most servers do not have a route registered at /v1/v1/..., so they return a 404. The request never reaches the intended handler, which is why the error often looks like a connectivity or authentication problem even though the host is reachable and the key is valid.
Why this is common in local AI connectors
The ambiguity comes from a convention mismatch. OpenAI-compatible providers, vLLM deployments, and services such as LLMRails commonly publish their base URL with /v1 included — for example, https://host/v1. Meanwhile, some client libraries append only /chat/completions and expect the caller to supply the version prefix, while others append the full /v1/chat/completions path. The Guardrails report notes that the same configuration worked under LLMRails because the LangChain OpenAI client only appends /chat/completions, whereas the Guardrails engine appended the versioned path itself (Guardrails issue #1862).
That difference explains a confusing symptom: the identical endpoint string can work in one tool and fail in another. It also means the bug is not usually in the provider — it is in how the connector composes the final URL.
Diagnose before you change anything
Work from the least invasive check to the most involved. Each step tells you whether the doubled path is the real cause or whether you are looking at a different problem.
- Read the exact error text. A doubled path typically returns
404 page not foundfrom the upstream server. Authentication failures usually return 401 or 403, and unsupported models return a different message. Match the symptom before assuming a URL problem. - Inspect the effective request URL. Many connectors log the final URL they call. If you can see
/v1/v1/in that log, the cause is confirmed. If the log shows a single/v1, look elsewhere. - Compare the configured endpoint with the provider documentation. Note whether the documented base URL already contains
/v1. This is the single most useful fact for choosing the right fix. - Test the URL directly. Sending the same request with a tool such as
curlisolates the connector from the server. If the manually composed single-/v1URL succeeds while the connector fails, the connector is adding the duplicate segment.
Mask any API keys when you copy logs or commands into a forum post. Replace the secret with a placeholder such as sk-REDACTED.
Fixes, ordered by effort
1. Change the endpoint value in settings
If the connector does not normalize the base URL, the fastest workaround is to enter the base URL without the trailing /v1. For example, use https://api.example.com instead of https://api.example.com/v1, so the client’s appended /v1/chat/completions produces the correct final path. This is a configuration change, not a code change, and it is reversible.
The tradeoff is that it depends on the client’s behavior. If you later switch to a tool that does not append the version segment, the same value will break. Treat this as a workaround, not a permanent contract.
2. Normalize the base URL in the connector
The durable fix is to normalize the base URL at the point where requests are composed. Both public fixes take this approach: strip a trailing slash and a single trailing /v1 before appending the versioned endpoint path. The VMark maintainer described the change as normalizing the REST API Endpoint so that https://api.example.com/v1 and https://api.example.com both resolve to https://api.example.com/v1/chat/completions, eliminating the doubled /v1/v1 404 (VMark issue #1084).
The following snippet is an illustrative normalization routine, not code copied from either project. It shows the logic you would apply in your own connector:
def normalize_base_url(base_url: str) -> str:
# Remove any trailing slashes
base = base_url.rstrip("/")
# Remove a single trailing /v1 if present
if base.endswith("/v1"):
base = base[:-3]
return base
def chat_completions_url(base_url: str) -> str:
return normalize_base_url(base_url) + "/v1/chat/completions"
Apply the same normalization to every versioned path the connector uses. The VMark fix covers all three paths — key test, model list, and prompt generation — for both OpenAI- and Anthropic-compatible providers, and includes unit tests for the normalization and the no-double-/v1 case (VMark issue #1084). The Guardrails change added unit and end-to-end tests across inputs with trailing slashes and with or without /v1 (Guardrails issue #1862).
3. Update to a fixed release
If the fix already exists upstream, upgrading is preferable to maintaining a local patch. VMark fixed the issue on main in commit c2064ce8 and stated that it ships in the next release (VMark issue #1084). Guardrails closed its fix through pull request #1862, which references issue #1861 (Guardrails issue #1862). Check the changelog or release notes for your installed version before assuming you have the fix.
Verify that the problem is resolved
After applying a fix, confirm the outcome rather than assuming it. A successful verification has three parts:
- The effective URL contains exactly one version segment. The request should resolve to
https://host/v1/chat/completions, nothttps://host/v1/v1/chat/completions. - The original operation succeeds. Re-run the same action that failed — a key test, a model list, or a prompt — and confirm it returns a normal response instead of
404 page not found. - Both endpoint forms behave the same. If your connector normalizes correctly, entering
https://hostandhttps://host/v1should produce the same final URL. This is the behavior the VMark fix documents (VMark issue #1084).
If the 404 persists after normalization, the doubled path was not the only problem. Re-check the host, port, and any reverse-proxy prefix, since a proxy that rewrites paths can reintroduce a duplicate segment.
Limitations, edge cases, and compatibility
Not every local AI connector is affected, and knowing the boundaries prevents unnecessary changes.
- Ollama is unaffected. Ollama uses
/api/*paths rather than the OpenAI/v1/*convention, so the doubled-/v1failure does not apply (VMark issue #1084). - Google AI is unaffected in the reported case because it uses a fixed endpoint rather than a user-supplied base URL (VMark issue #1084).
- Anthropic-compatible providers are affected alongside OpenAI-compatible ones. The versioned paths differ —
/v1/messagesversus/v1/chat/completionsand/v1/models— but the duplication mechanism is the same (VMark issue #1084). - Normalization must strip exactly one trailing
/v1. A host that legitimately contains/v1deeper in its path, or a custom prefix such as/openai/v1, needs care. Test both endpoint forms after any change.
The deeper tradeoff is that base-URL conventions are not standardized across the ecosystem. Some clients expect the version prefix in the base URL; others append it themselves. A connector that normalizes handles both, but it also silently accepts inputs that other tools would reject — which is convenient for users and slightly less predictable for maintainers.
What to do next
Start by reading the exact error and the effective request URL. If you see /v1/v1/, remove the trailing /v1 from your endpoint setting as an immediate workaround, then apply or upgrade to a connector that normalizes the base URL for a permanent fix. If you maintain the connector, add normalization at the request-composition point and cover it with a test that asserts both https://host and https://host/v1 resolve to a single-/v1 path.
If your setup still fails after these steps, share your environment — the client and version, the configured endpoint (with secrets masked), the effective request URL, and the exact error text — in the community so others can compare configurations.
FAQ
Does the doubled /v1 problem affect Ollama?
No. Ollama uses /api/* paths rather than the OpenAI /v1/* convention, so the duplication mechanism described here does not apply. Google AI is also reported as unaffected in the same bug report because it uses a fixed endpoint.
Should I remove /v1 from my configured endpoint?
Removing the trailing /v1 is a quick workaround if your client appends the version segment itself, because the final path then resolves correctly. It is not a permanent fix, since a client that does not append /v1 would then fail. A connector that normalizes the base URL handles both forms.
Why does the same endpoint work in one tool but fail in another?
Client libraries differ in what they append. Some add only /chat/completions and expect the base URL to include /v1; others append the full /v1/chat/completions path. The Guardrails report notes this exact difference between the LangChain OpenAI client and the Guardrails engine.
How can I confirm the duplicated path is the cause?
Check the effective request URL in your connector's logs or debug output. If it contains /v1/v1/, the duplication is confirmed. If it shows a single /v1 and the request still returns 404, investigate host, port, proxy rewriting, or routing instead.