Skip to main content
Hostlinku provides an endpoint compatible with the OpenAI Responses API—the format used by the Codex CLI, OpenAI Agents SDK, and the client.responses.create() method in the OpenAI SDK. Simply replace the base URL; the API key, balance, Service Mode, rate limit, and Request Logs are the same as for /v1/chat/completions and /v1/messages.
Each response includes an x-request-id header (Hostlinku request ID, in the format resp_…) and, for successful non-streaming responses, an x-model header.

Quick Setup

Complete guides for each tool are available in the Codex CLI and the OpenAI Agents SDK. Codex CLI (~/.codex/config.toml)
Python (Official OpenAI SDK)
Node.js
OpenAI Agents SDK (Python)

Body Parameters

Any other unknown fields are passed to the gateway (parameters not supported by the model will be ignored). An invalid body results in a 400 invalid_request_error response, with details for each field provided in error.details.issues.

Non-streaming response

id and model are always Hostlinku’s public identifiers. The hostlinku block is an extension (the OpenAI SDK ignores it) containing the cost , Service Mode API key, and latency. status: "incomplete" with incomplete_details.reason = "max_output_tokens" means the output was truncated by max_output_tokens—you’ll still be billed based on the actual number of tokens.

Streaming (stream: true)

The gateway forwards SSE events using the Responses API framing (event: + data:), including the sequence_number from the upstream:
Note:
  • The final usage is in the response object at response.completed (or response.incomplete); cost calculated based on actual usage following that event.
  • The tool call is passed via response.output_item.added (type: "function_call"), response.function_call_arguments.delta, and response.function_call_arguments.done.
  • If the stream fails midway, the gateway sends an event: error with {"type":"error","code":…,"message":…} and do not send a fake response.completed.
  • Errors occurring before the first byte (insufficient balance, model not found, rate limit) are returned as A standard JSON response with the correct HTTP status code — the OpenAI SDK maps it to an exception (AuthenticationError, NotFoundError, RateLimitError, …).

Tool calling (function calling)

Format error

Error messages never include the upstream provider’s identity. A complete list of codes for the Chat Completions format is available at Error.