Responses

The OpenAI Responses format, used by Codex CLI.

Creates a model response in the OpenAI Responses format, the format Codex CLI uses.

Method and path

POST/v1/responses

Base URL https://api.relayvia.dev/v1. Send the key as Authorization: Bearer sk-....

Common parameters

ParameterTypeRequiredDescription
modelstringYesOfficial model name.
inputstring | arrayYesText, or a list of input items: messages, images, files and tool outputs.
instructionsstringNoSystem instructions.
streambooleanNotrue to receive Server-Sent Events.
max_output_tokensintegerNoOutput limit; it decides how much is reserved before the call.
toolsarrayNoTools your code runs (function and custom tools).
tool_choicestring | objectNoWhether the model must, may or must not call a tool.
reasoningobjectNoReasoning effort and summary for reasoning models.
includearrayNoExtra output to return. Include reasoning.encrypted_content to carry reasoning into the next turn.

Requests are forwarded in the original format, so the original API's parameters work unless the next section says otherwise. This table lists the common ones; see the official reference for the rest.

Differences from the original API

  • There is no server-side conversation state. previous_response_id, conversation, input items referenced by id (item_reference, or an item with an id and no type), reasoning items without encrypted_content and a stored prompt template return 400 unsupported_parameter. Send the whole conversation in input each turn. store is always false, and GET /v1/responses/<id> is not provided.
  • tools[] accepts function and custom tools, and tool_search with execution: client, which Codex CLI runs locally. Other hosted tools return 400 unsupported_parameter.
  • Web search is not available. web_search tools are removed before forwarding and the request runs normally without search, so Codex CLI keeps working. If web search is the only tool, or tool_choice names it, the request returns 400 instead.
  • Remote files (input_file.file_url) return 400 unsupported_parameter; send the file inline as file_data.
  • user, safety_identifier and prompt_cache_key are scoped to your account before forwarding, so prompt caches and user ids are never shared with other accounts.
  • Events are forwarded as they arrive, and response.completed carries the usage. A : keepalive comment is sent after every 15 seconds without data. The model name in the response is the one you sent.
  • A non-streaming request with no response within 95 seconds returns 500 upstream_timeout; use streaming for long outputs. Or send the header X-Robi-Keepalive: 1: if there is no response within 30 seconds you get a 200 right away and a space every 15 seconds until the JSON arrives, and a later failure arrives as an error object in the body.

Request examples

cURL
curl https://api.relayvia.dev/v1/responses \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.5","input":"Hello!"}'

Response and streaming examples

Response
{
  "id": "resp_abc123",
  "object": "response",
  "status": "completed",
  "model": "gpt-5.5",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Hello! How can I help?"
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 9,
    "output_tokens": 8,
    "total_tokens": 17
  }
}

Errors this endpoint returns

HTTPcodeWhen
400invalid_requestA parameter is invalid. If the model rejected it, the message is this sentence, or Invalid value for parameter <param>. with param set.
400unsupported_parameterThe request uses something Relayvia does not offer: stored server-side state, a hosted tool or a remote file. param names it.
400invalid_mediaThe model reports that an input image or file format is not supported.
400media_unreachableThe model could not read the media URL you sent.
400content_policyThe input did not pass the model's safety review. If the model does not say whether the input or the output was refused, the message is Content did not pass safety review.
400content_policy_outputThe model generated a result, but the result did not pass safety review. Your input was not the problem.
401invalid_api_keyThe API key does not exist, is disabled or has expired.
402insufficient_quotaNot enough credits: the account's credits, the key's limit, the team member's limit or an account spend limit cannot cover the request, or the account is frozen.
403forbiddenThe key may not use this model, the source IP is not on the allowlist, or the account is disabled.
404model_not_foundThe model is not listed.
413request_too_largeThe request body is over 20 MB, or the model reports that the input exceeds its context or size limit (then with this sentence).
429rate_limitedToo many requests: per IP, per key, per account, or too many requests in progress at once.
500model_price_errorThe model has no price yet, so it cannot be called.
500upstream_errorRelayvia tried other model services and every attempt failed.
503no_available_channelNo model service is available for this model right now.
503service_busyEvery model service for this model reported being busy.
500upstream_timeoutEvery attempt timed out.

Every code, its fixed message and what to do are on the error codes page.