Bug Description
The nvidia inference provider type produces 404 errors from the NVIDIA Build API because of URL path duplication. The provider's default base_url is https://integrate.api.nvidia.com/v1, and the router appends the request path /v1/chat/completions, resulting in https://integrate.api.nvidia.com/v1/v1/chat/completions (double /v1).
The openai provider type works correctly with the same URL pattern, so the path deduplication logic works for OpenAI but not for NVIDIA.
Root Cause
The bug is in crates/openshell-router/src/backend.rs where the upstream URL is constructed by combining the route's endpoint (base URL) with the request path. The path deduplication that strips the /v1 prefix works for the OpenAI provider but does not apply to the NVIDIA provider.
Reproduction Steps
- Create an NVIDIA provider:
openshell provider create --name inference --type nvidia --credential "NVIDIA_API_KEY=nvapi-..."
- Create a sandbox and send a chat completion request through
inference.local
- Observe a
404 page not found response from the NVIDIA API
Verification that the API itself works
Direct curl to the NVIDIA endpoint succeeds:
curl -s https://integrate.api.nvidia.com/v1/chat/completions \
-H "Authorization: Bearer nvapi-..." \
-H "Content-Type: application/json" \
-d '{"model":"meta/llama-3.3-70b-instruct","messages":[{"role":"user","content":"hello"}]}'
This returns a valid response, confirming the issue is in URL construction, not the API itself.
Expected Behavior
The router should deduplicate the /v1 prefix, producing:
https://integrate.api.nvidia.com/v1/chat/completions
Actual Behavior
The router produces:
https://integrate.api.nvidia.com/v1/v1/chat/completions
This results in a 404 page not found from the NVIDIA API.
Environment
- OpenShell gateway v0.0.98-dev.23 (commit ea690499)
- Deployed on OpenShift in VMs
Agent Diagnostic
- Confirmed direct API access works with curl (valid 200 response from
meta/llama-3.3-70b-instruct)
- Traced the routing path: supervisor proxy -> gateway
GetInferenceBundle -> router -> NVIDIA API
- Identified the URL construction in
crates/openshell-router/src/backend.rs as the source of the duplication
- The OpenAI provider handles the same pattern correctly, indicating the fix should extend the existing deduplication logic to cover the NVIDIA provider type
Bug Description
The
nvidiainference provider type produces 404 errors from the NVIDIA Build API because of URL path duplication. The provider's defaultbase_urlishttps://integrate.api.nvidia.com/v1, and the router appends the request path/v1/chat/completions, resulting inhttps://integrate.api.nvidia.com/v1/v1/chat/completions(double/v1).The
openaiprovider type works correctly with the same URL pattern, so the path deduplication logic works for OpenAI but not for NVIDIA.Root Cause
The bug is in
crates/openshell-router/src/backend.rswhere the upstream URL is constructed by combining the route'sendpoint(base URL) with the request path. The path deduplication that strips the/v1prefix works for the OpenAI provider but does not apply to the NVIDIA provider.Reproduction Steps
openshell provider create --name inference --type nvidia --credential "NVIDIA_API_KEY=nvapi-..."inference.local404 page not foundresponse from the NVIDIA APIVerification that the API itself works
Direct curl to the NVIDIA endpoint succeeds:
This returns a valid response, confirming the issue is in URL construction, not the API itself.
Expected Behavior
The router should deduplicate the
/v1prefix, producing:https://integrate.api.nvidia.com/v1/chat/completionsActual Behavior
The router produces:
https://integrate.api.nvidia.com/v1/v1/chat/completionsThis results in a
404 page not foundfrom the NVIDIA API.Environment
Agent Diagnostic
meta/llama-3.3-70b-instruct)GetInferenceBundle-> router -> NVIDIA APIcrates/openshell-router/src/backend.rsas the source of the duplication