Inference

Responses

Beta

A text-only subset of the OpenAI Responses API, with streaming.

Endpoint

POST/v1/responses

Requires an API key with the inference scope. Receipts record the operation as inference.responses.

Request body

ParameterTypeRequiredDescription
modelstringRequiredModel ID from GET /v1/models.
inputstring | arrayRequiredA non-empty string, or 1–500 input items. See Input formats.
instructionsstringOptionalUp to 200,000 characters. Sent to the model as a system message ahead of the input.
max_output_tokensintegerOptional1–128,000. Reduced to the model's cap. Determines the balance reservation.
temperaturenumberOptional0–2. Ignored for models that do not support sampling parameters.
top_pnumberOptional0–1. Ignored for models that do not support sampling parameters.
streambooleanOptionalStream typed events. Default false.
storebooleanOptionalAccepted and ignored. Responses are never stored.

Other fields, including tools and previous_response_id, are ignored.

Input formats

A string input becomes a single user message. An array contains message items with a role and content; type: "message" is optional.

FieldAccepted values
rolesystem, developer (treated as system), user, assistant
contentA string, or up to 64 parts of type input_text, output_text or text. Part texts are concatenated.
Array input
{
  "model": "gpt-5-mini",
  "input": [
    { "role": "developer", "content": "Be brief." },
    { "role": "user", "content": [{ "type": "input_text", "text": "Name three ledger entry types." }] },
    { "role": "assistant", "content": [{ "type": "output_text", "text": "credit, debit, reserve" }] },
    { "role": "user", "content": "And the other two?" }
  ]
}

Any other part type, including images and files, fails validation with HTTP 400.

Example

curl https://www.hushcompute.xyz/v1/responses \
  -H "Authorization: Bearer $HUSH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5-mini",
    "instructions": "Reply in plain text.",
    "input": "Summarize the difference between a budget and a balance.",
    "max_output_tokens": 400
  }'

Response object

200 OK
{
  "id": "resp_01K58ZQ4W5V8E2R7PKD3N6A0TG",
  "object": "response",
  "created_at": 1789387200,
  "status": "completed",
  "model": "gpt-5-mini",
  "output": [
    {
      "type": "message",
      "id": "msg_01K58ZQ4W5V8E2R7PKD3N6A0TG",
      "status": "completed",
      "role": "assistant",
      "content": [{ "type": "output_text", "text": "A balance is ...", "annotations": [] }]
    }
  ],
  "output_text": "A balance is ...",
  "usage": { "input_tokens": 41, "output_tokens": 118, "total_tokens": 159 },
  "receipt": {
    "id": "rcpt_01K58ZQ4W6N3T2B9XRC7D1M5HJ",
    "hash": "0x6f0d…a3c9",
    "signature": "0x9b1f…c07e1b",
    "signer": "0x3A4c…91De",
    "url": "https://www.hushcompute.xyz/proofs/rcpt_01K58ZQ4W6N3T2B9XRC7D1M5HJ"
  },
  "billing": {
    "request_id": "req_01K58ZQ4W5V8E2R7PKD3N6A0TG",
    "cost_micro_usd": "272",
    "cost_usd": "0.000272",
    "usage_estimated": false,
    "fingerprint_salt": "0x51c2…7f08"
  }
}
FieldTypeDescription
idstringresp_ followed by the request ID's suffix. The request ID is in billing.request_id and x-request-id.
statusstringcompleted, or incomplete when output stopped at max_output_tokens.
outputarrayOne assistant message with a single output_text part.
output_textstringConvenience copy of the generated text.
usageobjectinput_tokens, output_tokens, total_tokens as billed.
receiptobjectSame shape as Chat Completions: id, hash, signature, signer, url.
billingobjectrequest_id, cost_micro_usd, cost_usd, usage_estimated, fingerprint_salt.

Streaming

With stream: true the response is a stream of named Server-Sent Events. Each event has an event: line and a JSON data: line whose type matches the event name. There is no [DONE] sentinel; the stream closes after the last event.

EventPayload
response.createdresponse with id, status in_progress and model.
response.output_text.deltaoutput_index 0, content_index 0, delta with the next text fragment.
response.completedresponse: the full response object, including receipt and billing.
errorerror object in the standard shape. Sent instead of response.completed.
Wire format
event: response.created
data: {"type":"response.created","response":{"id":"resp_01K5…","status":"in_progress","model":"gpt-5-mini"}}

event: response.output_text.delta
data: {"type":"response.output_text.delta","output_index":0,"content_index":0,"delta":"A balance is"}

event: response.completed
data: {"type":"response.completed","response":{"id":"resp_01K5…","object":"response","status":"completed", … ,"receipt":{…},"billing":{…}}}

Partial-output rules match Chat Completions: if text was delivered before a failure, that portion is billed and receipted with status failed. The error event does not repeat the receipt; its ID is the x-receipt-id header sent when the stream opened. If nothing was delivered, nothing is charged and no receipt exists.

Limitations

  • No tools, function calling, web search or file search.
  • No stored state: store is ignored and previous_response_id is not supported.
  • Text input and output only.
  • Reasoning items are not returned.

For tool calling use Chat Completions.