Skip to main content
Sign in

Website navigation

API referenceResponses

Responses

OpenAI Responses compatibility for Codex and other clients. Send input and read messages, reasoning, and tool calls as separate items in output.

POSThttps://api.saveapi.cc/v1/responses
On this page

Request example

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.

Example language
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
}'

Headers

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.

Request parameters

This list covers common request fields. Optional settings depend on the selected model and API format.

modelstringRequired
Match a data[].id from GET /v1/models exactly. An unavailable model returns 404 model_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 true to receive server-sent events. Omit for JSON.
toolsarray
Define client-executed function or custom tools. Select a tool with tool_choice and control parallel calls with parallel_tool_calls.
textobject
Set the text output format. Use text.format to 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 in input.
previous_response_idstring
This field returns 400. To continue a conversation, send the full context in input.
includearray
Select extra response data. Where supported, request reasoning.encrypted_content and include the returned reasoning items in the next input.
prompt_cache_keystring
Use a prompt cache key of up to 64 characters on compatible models. Reuse the key across turns in a session.

How SaveAPI handles requests

  • The conversation and prompt reference fields return 400. Supply their content directly in input.
  • Only stateless text input is supported; image, audio, video and PDF inputs return 400.

JSON response

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.

JSON
{
  "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-id response header when reporting an issue, if available. It identifies the request on this platform.
  • For GPT, input_tokens includes cached tokens. See input_tokens_details.cached_tokens for cache reads and output_tokens_details.reasoning_tokens for reasoning.

Streaming

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.

Example language
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
}'

Error format

Check status and error as well as the HTTP status. Inspect incomplete_details when output is incomplete.

JSON
{
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_request_error",
    "message": "Include the conversation history in input."
  }
}