Provider Proxy API
Securely access provider-specific features through GoodMem with automatic credential injection
Provider Proxy API
Forward provider-specific HTTP requests through GoodMem to reuse stored credentials and centralized access control. The proxy works with any registered embedder, reranker, or LLM resource.
Endpoint structure
/v1/proxy/{resource-type}/{resource-id}/{provider-path}{resource-type}—embedders,rerankers, orllms{resource-id}— UUID returned when the resource was registered with GoodMem{provider-path}— provider-specific suffix (for examplev1/modelsortokenize)
{provider-path} is appended to the inference target’s stored endpointUrl before the call is forwarded. Common scenarios include:
- Registered endpointUrl:
https://api.openai.com/v1→ proxy callGET /v1/proxy/embedders/{id}/modelsforwards tohttps://api.openai.com/v1/models - Registered endpointUrl:
https://custom-vllm.com/inference→ proxy callPOST /v1/proxy/llms/{id}/v1/completionsforwards tohttps://custom-vllm.com/inference/v1/completions
Query strings are appended unchanged.
HTTP methods and query strings pass through unchanged; the proxy simply streams the upstream response back to the caller.
The proxy does not rewrite payloads. Any provider-specific request or response formats must already be compatible with the target API.
Authentication and authorization
- Clients present their GoodMem API key (
x-api-key) instead of vendor credentials. - GoodMem authenticates the key, enforces
READ_*visibility, and checks the proxy-specific permissions:PROXY_INFERENCE_TARGET_ANYPROXY_INFERENCE_TARGET_OWN
- If authorized, the server retrieves the stored provider configuration and forwards the request.
Unauthorized calls return 401; calls lacking proxy permissions return 403 and are not forwarded to the provider.
Credential injection and forwarding
- The proxy removes the client-supplied
x-api-keyheader and any existingAuthorizationheader before forwarding. - If the registered resource has stored credentials, the proxy injects
Authorization: Bearer <stored-token>before sending the request upstream. Resources without stored credentials (for example, unauthenticated vLLM deployments) are forwarded without anAuthorizationheader. Only Bearer-style secrets are injected in v1; other auth patterns still require calling the provider directly. - Request and response bodies stream over Jetty’s non-blocking proxy, so large payloads and streaming responses work out of the box.
- Status codes and headers from the provider are preserved.
- Requests are audit logged the same way as other REST calls, and Micrometer metrics record request volume, latency, payload sizes, and upstream error rates.
Example requests
List OpenAI models through GoodMem:
curl \
-H "x-api-key: gm_your_key" \
https://api.goodmem.ai/v1/proxy/embedders/62a805e9-e539-4cb2-9d34-9482d8163437/v1/modelsCall a custom tokenization endpoint:
curl \
-H "x-api-key: gm_your_key" \
-H "Content-Type: application/json" \
-d '{"text":"Hello world"}' \
https://api.goodmem.ai/v1/proxy/embedders/62a805e9-e539-4cb2-9d34-9482d8163437/tokenizeForward a rerank operation:
curl \
-H "x-api-key: gm_your_key" \
-H "Content-Type: application/json" \
-d '{"query":"lakes"}' \
https://api.goodmem.ai/v1/proxy/rerankers/d08546f5-694b-4f5f-96cc-091d07437957/rerankOperational limits
- Only Bearer-style secrets are injected in v1; other auth patterns require calling the provider directly.
- Provider responses (4xx/5xx) pass through unchanged.
- WebSockets are not proxied.
- Standard GoodMem rate limits apply to proxy traffic. Provider-side throttling also still applies.
- The proxy inherits the TLS requirements of the provider
endpointUrl; certificate validation follows Jetty defaults.
Observability
- Prometheus counter
goodmem.proxy.requests.totaltracks request volume by resource type, HTTP method, status code, and provider type. - Timer
goodmem.proxy.request.durationmeasures end-to-end latency and is tagged with resource type, provider type, and status class. goodmem.proxy.auth_failures.totalcounts authentication or authorization failures before a request reaches the upstream provider.- Payload sizes are recorded in
goodmem.proxy.request.size.bytesandgoodmem.proxy.response.size.bytes. - Upstream 5xx responses increment
goodmem.proxy.provider_errors.totalwith the resource ID and provider type. - All requests are audit logged with the authenticated user, target resource, method, and upstream status.
Troubleshooting
| Symptom | Suggested fix |
|---|---|
401 Unauthorized | Ensure x-api-key is present and valid. |
403 Forbidden | Verify the API key has the appropriate READ_* and PROXY_* permissions. |
404 Not Found | Confirm the resource UUID is correct and enabled. |
| Provider error response | Inspect the body; it’s returned verbatim from the provider. |
| Empty response | Check provider reachability and GoodMem audit logs. |
Related links
- Server runtime footprint — networking, health probes, and monitoring endpoints.
- Source code:
server/src/main/java/com/goodmem/proxy/ - Permission definitions:
server/src/main/java/com/goodmem/security/Permission.java