Skip to navigation

Run chat completion inference

View as Markdown

The only admitted POST. A bare model id is rewritten to its pinned default serving provider; an explicit model:provider suffix is honored only if that exact pairing is cataloged, and the router’s own :fastest/:cheapest/:preferred policy suffixes are rejected outright (see the Hugging Face tag description above). tools[] items must be type: "function". The client-suppliable X-HF-Bill-To header is always removed.

Authentication

AuthorizationBearer

Your per-client bearer token — the API key the gateway issued to you. Present it in Authorization: Bearer <token> form. A token that is missing, unknown, or revoked draws a 401. Before the call is sent upstream the token is removed (stripped, or swapped for the upstream’s own credential); it never makes it past the gateway.

Path parameters

pathstringRequired

The path to call on Hugging Face’s Inference Providers router, any further / segments included — all of it after /huggingface/ is passed to https://router.huggingface.co/ when the gateway’s (model, provider) catalog admits the request (see the Hugging Face tag description above). Only two forms are admitted: v1/chat/completions and v1/models[/{owner}/{repo}].

Request

This endpoint expects a map from strings to any.

Response

Whatever the upstream answered, relayed as-is (status, headers, body). Rendered here as JSON; the true shape is the upstream provider’s to define.

Errors

400
Bad Request Error
401
Unauthorized Error
404
Not Found Error