Use the Responses API
Send a bounded OpenAI Responses request and retrieve a stored result.
Send a bounded OpenAI Responses request and retrieve a stored result.
Set BASE_URL to your HTTPS API origin without a trailing slash or /v1, and pass API_KEY from your credential store. OpenAI-compatible SDKs use ${BASE_URL}/v1; Anthropic-compatible SDKs use BASE_URL.
Responses is the main OpenAI-compatible inference surface. You need an API key, an available model ID, and credits. Generation can consume credits.
printf 'Authorization: Bearer %s\n' "$API_KEY" \
| curl -q -H @- -i "$BASE_URL/v1/responses" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-sol",
"input": "Say hello in one sentence.",
"max_output_tokens": 64,
"stream": false,
"store": true
}'
A successful non-stream response has an id, model, status, output and usage. The generated words vary. Keep the HTTP request-id header for support without sending input text. API Activity shows recent run outcomes; its row ID differs from that header. A stored response can be retrieved with GET /v1/responses/{id} using the same organization's key. If you set store to false and do not bind a conversation, retrieval is unavailable.
This is an example of a successful response shape. Your ID, text, and token counts will differ:
{
"id": "resp_018f3f407b447cc4b8ba3f62656c299c",
"object": "response",
"created_at": 1790244000,
"status": "completed",
"incomplete_details": null,
"model": "gpt-5.6-sol",
"output": [
{
"id": "msg_018f3f407b447cc4b8ba3f62656c299c",
"type": "message",
"role": "assistant",
"status": "completed",
"content": [{ "type": "output_text", "text": "Done.", "annotations": [] }]
}
],
"output_text": "Done.",
"usage": {
"input_tokens": 12,
"input_tokens_details": { "cached_tokens": 0 },
"output_tokens": 5,
"output_tokens_details": { "reasoning_tokens": 0 },
"total_tokens": 17
}
}
Check status first. For a simple text response, read output_text; for tools, citations, or multiple blocks, process each output item by type. usage describes protocol tokens. The finalized credit debit is on API Activity; do not derive a money price from total_tokens alone. With status: incomplete, inspect incomplete_details.reason and do not present partial text as a complete answer.
Use the id from the completed JSON response. The cURL example prompts for it; set UNLIMGPT_RESPONSE_ID in the environment for TypeScript, Python, or Go. This read does not start another generation:
printf 'Response id: '
read -r UNLIMGPT_RESPONSE_ID
printf 'Authorization: Bearer %s\n' "$API_KEY" \
| curl -q -H @- -i "$BASE_URL/v1/responses/$UNLIMGPT_RESPONSE_ID"
HTTP 200 returns the stored response with its id, status, output, and usage; check that the id matches the one you entered. An unknown, deleted, or inaccessible response returns 404. The request above uses store: true; with store: false, a stateless response cannot be retrieved.
The body id identifies a stored response or explicit cancellation; the HTTP request-id header is for support. GET /v1/responses/{id} requires a key from the same organization. Continuing with previous_response_id is not supported yet: include the required history in a new input. After a network interruption, retry the logical request with its original Idempotency-Key as described in safe retries.
For incremental output, see streaming.