Responses
OpenAI Responses compatibility for Codex and other clients. Send input and read messages, reasoning, and tool calls as separate items in output.
https://api.saveapi.cc/v1/responsesOn this page
The example uses gpt-6.1-sol. Set the SDK base URL to https://api.saveapi.cc/v1. Check that your chosen model supports Responses before switching.
curl -sS "https://api.saveapi.cc/v1/responses" \
-H "Authorization: Bearer $AI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"instructions": "You are a helpful assistant.",
"input": [
{
"role": "user",
"content": "Hello"
}
],
"reasoning": {
"effort": "medium"
},
"store": false
}'AuthorizationBearer YOUR_API_KEYRequired- Use your platform API key. You can also send
x-api-key: YOUR_API_KEY. Content-Typeapplication/json- The request body is JSON.
This list covers common request fields. Optional settings depend on the selected model and API format.
modelstringRequired- Match a
data[].idfromGET /v1/modelsexactly. An unavailable model returns404model_not_found. inputstring | arrayRequired- Send a string for a single turn or an ordered list of messages and input items for multiple turns.
instructionsstring- Provide system-level instructions for this request.
reasoningobject- Configure supported reasoning options, for example
{"effort":"high","summary":"auto"}. Claude uses its default here. Use Messages to configure Claude thinking. streamboolean- Set
trueto receive server-sent events. Omit for JSON. toolsarray- Define client-executed
functionorcustomtools. Select a tool withtool_choiceand control parallel calls withparallel_tool_calls. textobject- Set the text output format. Use
text.formatto provide a JSON Schema for supported models. max_output_tokensinteger- Set an output limit from 1 to 32768, with 4096 as the default. Some GPT models determine their own output length.
storeboolean- This is always set to
false. Supply the history needed for each call ininput. previous_response_idstring- This field returns
400. To continue a conversation, send the full context ininput. includearray- Select extra response data. Where supported, request
reasoning.encrypted_contentand include the returnedreasoningitems in the nextinput. prompt_cache_keystring- Use a prompt cache key of up to 64 characters on compatible models. Reuse the key across turns in a session.
- The
conversationandpromptreference fields return400. Supply their content directly ininput. - Only stateless text input is supported; image, audio, video and PDF inputs return
400.
Check status first. Traverse message items in output and extract output_text blocks. The SDK’s output_text helper joins them. usage includes input_tokens, output_tokens and total_tokens.
On models that support function tools, use the function_call’s call_id in the next request’s function_call_output item.
{
"id": "resp_example",
"object": "response",
"status": "completed",
"model": "gpt-6.1-sol",
"output": [
{
"id": "rs_example",
"type": "reasoning",
"summary": []
},
{
"id": "msg_example",
"type": "message",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "Hello!",
"annotations": []
}
]
}
],
"usage": {
"input_tokens": 7,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 4,
"output_tokens_details": {
"reasoning_tokens": 2
},
"total_tokens": 11
}
}- Include the
x-request-idresponse header when reporting an issue, if available. It identifies the request on this platform. - For GPT,
input_tokensincludes cached tokens. Seeinput_tokens_details.cached_tokensfor cache reads andoutput_tokens_details.reasoning_tokensfor reasoning.
Read text deltas from response.output_text.delta and use response.completed to detect success. Handle response.failed, response.incomplete, error, or an early disconnect separately.
curl -NsS "https://api.saveapi.cc/v1/responses" \
-H "Authorization: Bearer $AI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"instructions": "You are a helpful assistant.",
"input": [
{
"role": "user",
"content": "Hello"
}
],
"reasoning": {
"effort": "medium"
},
"store": false,
"stream": true
}'Check status and error as well as the HTTP status. Inspect incomplete_details when output is incomplete.
{
"error": {
"type": "invalid_request_error",
"code": "invalid_request_error",
"message": "Include the conversation history in input."
}
}