Skip to main content
Hostlinku’s main endpoint. The request and response formats are compatible with the OpenAI Chat Completions API, so you can use the official OpenAI SDK simply by changing base_url to https://api.hostlinku.com/v1.
Each response includes the x-request-id header (Hostlinku request ID) and, for successful non-streaming responses, the x-model header (the public slug of the model that served the request).

Body Parameters

Example: Non-streaming request (curl)

Response (abridged):
The model field always contains the Hostlinku public slug (not the internal ID), and the additional hostlinku block is always present in a successful response, containing only the cost and latency of the request:

Streaming (stream: true)

With stream: true, the gateway responds with Content-Type: text/event-stream (SSE), streams chunks in an OpenAI-compatible format (each chunk uses a public Hostlinku id and the same model slug), and then closes the stream with data: [DONE]:
Important note:
  • If a failure occurs during the stream, the gateway sends a single error event (data: {"error": { "code": …, "message": … }}) and does not send a fake [DONE]. A disconnected stream never looks like a stream that has completed normally.
  • Fixed costs are calculated based on actual usage after the stream ends; if usage data is not available, The invoice uses the estimate that was reserved when the request was received.
  • The x-request-id header is also sent in streaming responses to correlate with logs in console.

Example: Python (Official OpenAI SDK)

There are no code changes other than base_url. The OpenAI SDK is ready to use:

Common errors on this endpoint

The complete format of the error envelope is available at Error.