Contact
Skip to the page text

Documentation / Guides / Inference API

Passthrough APIs (path prefix)

Some models answer an API of their own (for example OCR or layout parsing) instead of the OpenAI or Anthropic API. The gateway forwards such a passthrough API as it is: any method, any body, routed by its path and not by a model field. It checks the same Bearer key as on every other path. Each passthrough API answers under a path prefix.

POST https://<platform-address>/<path-prefix>/<service-path>
Authorization: Bearer onprem-gw-your-key

How the routing works

  • The model's deploy profile sets the path prefix (path_prefix in its api.passthrough). Usually it starts with the name the model is deployed under: a model deployed as pp-ocrv6 answers under /pp-ocrv6.
  • A request matches a passthrough API when its path equals the prefix or starts with it, by whole path segments.
  • The gateway removes the prefix and forwards the rest of the path to the model. The deploy profile can put another prefix in its place (upstream_path_prefix).
  • Method, query string, request headers (except Host and Authorization), and body are forwarded as-is. Request bodies up to 16 MiB.
  • The model's response is returned with its status code, headers, and body verbatim -- unlike the LLM endpoints, the gateway does not wrap the model's errors. The response is passed on as the model sends it.
  • A path that no deployed model answers returns 404 with the code no_such_route.

Request shape is model-specific

The gateway does not define the request schema -- the model's service does. The deploy profile's passthrough API names its endpoints and can declare a working request example, its smoke_test: the request headers, the request itself -- a JSON body, or a multipart form for an API that takes an upload -- and the status a correct answer has. For a model whose first API is a passthrough API (it has no OpenAI or Anthropic API), the platform sends that request through the gateway to the API's one declared endpoint on a fixed schedule, as the model's smoke test, so a passing smoke test shows that the example works. To read it, open the model's menu on the Models page and select Show definition.

When the first passthrough API of a deployed model declares a smoke_test and exactly one endpoint, the deploy profile list (GET /api/v1/model-catalog/deploy-profiles/list) gives that request as the profile's passthrough_smoke_test: the request the platform's smoke test sends, with method, path, headers, body or multipart, and expected_status. Exactly one of body and multipart is set; the other is null. Its path is the full API gateway path: the path_prefix with {routing_model_id} filled in, then the endpoint. For example, a path_prefix of /{routing_model_id} with the endpoint POST /ocr, deployed as pp-ocrv6, gives /pp-ocrv6/ocr. A client sends it after the API gateway's address as it is. The APIs page shows this request as a curl command (the Custom API tab of the code examples), and the Playground page fills its request with it. Without a smoke_test, or with more than one endpoint, passthrough_smoke_test is null and the model has no example there; the profile's publisher adds one under api.passthrough[].smoke_test.

A multipart request is a list of form parts in the order they are sent. Each part has a name and either a value (a text field) or a file: a sample file of the deploy profile, given with its filename, its content_type and its size_bytes. The file stays in the control plane: the platform's smoke test reads it from the deploy profile and uploads it, and the APIs page shows the part as -F "file=@hello.wav;type=audio/wav", a file you supply under that name. The Playground page fills the form's text fields from the parts and sends the audio file you choose in place of the sample.

Illustrative shape for a PaddleOCR-style layout-parsing service:

curl -X POST https://<platform-address>/<path-prefix>/layout-parsing \
  -H "Authorization: Bearer onprem-gw-your-key" \
  -H "Content-Type: application/json" \
  -d '{"file": "'$(base64 -w0 document.png)'", "fileType": 1}'

And for an OpenAI-style audio transcription service, which takes a multipart upload:

curl -X POST https://<platform-address>/<path-prefix>/v1/audio/transcriptions \
  -H "Authorization: Bearer onprem-gw-your-key" \
  -F "file=@hello.wav;type=audio/wav" \
  -F "language=en"

The exact path and body fields vary per model -- always start from the smoke_test in the model's deploy profile.

Overload protection

The gateway sets no limit of its own on how many passthrough requests run at once: each replica's engine decides how many it runs and queues the rest. When the model is deployed but none of its replicas on the inference nodes can take the request, the gateway rejects it with HTTP 503 and code: "model_not_available"; retry later. This one IS a gateway-wrapped error, since the request never reached the model. The refusals the gateway makes are in How the Gateway Refuses Work.

Found a mistake, or is something missing? Suggest an improvement to this page on GitHub.

Platform release 5.10.4, . Source of this page at v5.10.4. This page as Markdown.