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.
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)
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:
- The final usage is in the
responseobject atresponse.completed(orresponse.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, andresponse.function_call_arguments.done. - If the stream fails midway, the gateway sends an
event: errorwith{"type":"error","code":…,"message":…}and do not send a fakeresponse.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.

