Docs / API
Responses
POST /v1/responses in the OpenAI Responses format.
Last updated
Your setup
Fills in YOUR_API_KEY in the code on this page. The key stays in this tab: it is never sent and never saved.
Endpoint
POST https://api.cent-ai.dev/v1/responses
Authorization: Bearer cai_<secret>
Content-Type: application/json
The endpoint follows the OpenAI Responses format. Use the base URL https://api.cent-ai.dev/v1.
Request
model, input, stream, tools, reasoning and previous_response_id are sent to the model as is, like every other parameter.
| Topic | Behaviour |
|---|---|
previous_response_id | Passed through unchanged |
store | Passed to the model when it supports it. Cent AI does not keep response state itself |
| Usage | usage.input_tokens, usage.input_tokens_details.cached_tokens and usage.output_tokens, plus usage.cost |
Example
curl https://api.cent-ai.dev/v1/responses \
-H "Authorization: Bearer $CENT_AI_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-6-sol","input":"Hello"}'
Response
{
"id": "resp_7a1",
"object": "response",
"model": "gpt-6-sol",
"status": "completed",
"output": [{"type": "message", "role": "assistant", "content": [{"type": "output_text", "text": "Hello!"}]}],
"usage": {
"input_tokens": 5200,
"input_tokens_details": {"cached_tokens": 4800},
"output_tokens": 310,
"total_tokens": 5510,
"cost": "0.000124000"
}
}
Streaming
With stream: true you receive the standard Responses events: response.created, response.output_text.delta and response.completed. The response object inside response.completed carries usage.cost. If the stream fails after it started, you receive response.failed with the error code, see Stream timeout.
event: response.created
data: {"type":"response.created","sequence_number":0,"response":{"id":"resp_7a1","object":"response","created_at":1792051200,"status":"in_progress","model":"gpt-6-sol","output":[],"usage":null}}
event: response.output_text.delta
data: {"type":"response.output_text.delta","sequence_number":4,"item_id":"msg_7a1","output_index":0,"content_index":0,"delta":"Hello","logprobs":[]}
event: response.completed
data: {"type":"response.completed","sequence_number":7,"response":{"id":"resp_7a1","object":"response","created_at":1792051200,"status":"completed","model":"gpt-6-sol","output":[{"type":"message","id":"msg_7a1","role":"assistant","status":"completed","content":[{"type":"output_text","text":"Hello!","annotations":[]}]}],"usage":{"input_tokens":5200,"input_tokens_details":{"cached_tokens":4800},"output_tokens":310,"total_tokens":5510,"cost":"0.000124000"}}}
The example is shortened: other standard events, such as response.output_item.added and response.content_part.added, arrive between these and are passed on too.
Contract
POST/v1/responses
Responses (OpenAI format)
Auth · API key (Bearer or x-api-key)
Request body
inputobjectrequiredmodelstringrequiredprevious_response_idstringoptionalstorebooleanoptionalstreambooleanoptional
Responses
- 200Response object, or an SSE stream of Responses events;
usage.costis on the response inresponse.completed. - 400Error in the OpenAI shape.
- 401Error in the OpenAI shape.
- 402Error in the OpenAI shape.
- 403Error in the OpenAI shape.
- 404Error in the OpenAI shape.
- 413Error in the OpenAI shape.
- 429Error in the OpenAI shape that may be retried after Retry-After.retry
- 500Error in the OpenAI shape.
- 503Error in the OpenAI shape that may be retried after Retry-After.retry
Response headers
Retry-Afterx-request-id
Generated from the OpenAPI contract.