Repository navigation
Description
Summary
Every README example builds the client as InferenceGatewayClient("http://localhost:8080/v1"), and the constructor docstring says base_url "should include /v1" (inference_gateway/client.py line 112). The README "Health Check" and "Proxy Requests" sections call client.health_check() and client.proxy_request(provider="openai", path="/v1/models", method="GET") on that client. Both methods append their route to base_url unchanged:
health_check()(line 1255):f"{self.base_url}/health"->http://localhost:8080/v1/healthproxy_request()(line 1234):f"{self.base_url}/proxy/{provider_value}/..."->http://localhost:8080/v1/proxy/openai/v1/models
The gateway serves both routes at the root, not under /v1. openapi.yaml (lines 17-23) puts the Health and Proxy tags on the unversioned http://localhost:8080 server ("Default server without version prefix for healthcheck and proxy"). The gateway's cmd/gateway/main.go registers GET /health and ANY /proxy/:provider/*path on the root router, outside its /v1 group.
The SDK already handles this for the other root-level routes: mcp_jsonrpc() and get_mcp_protected_resource_metadata() use the _root_url property (lines 221-224) to strip a trailing /v1. health_check() and proxy_request() do not use it. The unit tests pass only because test_health_check and test_proxy_request build a separate client without /v1 (InferenceGatewayClient("http://test-api")). The README never tells users to do that.
Steps to Reproduce
- Run an Inference Gateway on
localhost:8080. - Create the client as the README does:
client = InferenceGatewayClient("http://localhost:8080/v1"). - Call
client.health_check()(README "Health Check"). - Call
client.proxy_request(provider="openai", path="/v1/models", method="GET")(README "Proxy Requests").
Expected Behavior
Both methods target the root-level routes (GET /health and /proxy/{provider}/{path}) even when base_url ends in /v1, as mcp_jsonrpc() does through _root_url. health_check() returns True for a healthy gateway and proxy_request() returns the provider response.
Actual Behavior
The SDK requests GET /v1/health and GET /v1/proxy/openai/v1/models. The gateway does not route either path, so both calls get an HTTP error. health_check() swallows the error and returns False, so the README example prints "API is unavailable" for a healthy gateway. proxy_request() raises InferenceGatewayAPIError.
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone
Activity
edenreich commentedon Sep 25, 2026
@infer Can you fix this?
inference-gateway-maintainer commentedon Sep 25, 2026
Model:
ollama_cloud/glm-5.3-flash· View JobTodos
Pull Request
#136
✅ Infer Result: Success
Fixed. PR #136 is ready for review: #136
Summary
health_check()andproxy_request()were appending their route directly tobase_url, so a client built the way every README example builds it (InferenceGatewayClient("http://localhost:8080/v1")) requested/v1/healthand/v1/proxy/{provider}/...- paths the gateway does not serve. Both methods now build their URLs from the existing_root_urlhelper, which strips a trailing/v1, exactly the waymcp_jsonrpc()andget_mcp_protected_resource_metadata()already handle root-level routes.Changes
inference_gateway/client.py:proxy_request()builds the proxy URL fromself._root_url;health_check()checksf"{self._root_url}/health"; both docstrings now note the routes live at the gateway root and that a/v1suffix is stripped.tests/test_client.py: addedtest_health_check_with_v1_base_urlandtest_proxy_request_with_v1_base_url, asserting that a client built withhttp://test-api/v1hitshttp://test-api/healthandhttp://test-api/proxy/openai/v1/modelsrespectively. The previous tests passed only because they built a client without/v1.Verification
task test: 43 passed, 1 xfailed (pre-existing, unrelated to this fix), including both new regression tests.task lint: black, isort, and mypy all clean.Housekeeping
Model:
ollama_cloud/glm-5.3-flash· Exit Code:0· Duration: 3m 15sTokens: 1,070,481 in · 12,916 out · 1,083,397 total (27 requests)
Tool calls: 45 total · 100% success rate
Traces
Stats
Triggered by edenreich · Infer Action · OSS
inference-gateway-releaser commentedon Sep 26, 2026
🎉 This issue has been resolved in version 0.21.1 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀