Skip to main content
POST
Create a response
This endpoint is compatible with the OpenAI Responses protocol for creating chat completion requests.

Features

  • Supports both streaming (SSE) and non-streaming response modes
  • Supports function calling and tool calling
  • Supports structured output (JSON Schema)
  • Supports reasoning effort configuration
  • Supports web search options

Use cases

Suitable for scenarios requiring interaction with OpenAI-compatible models, including:
  • Single-turn or multi-turn conversations
  • Function calling and tool orchestration
  • Structured JSON output
  • Real-time streaming responses

Authentication

Include the Authorization header in the format Bearer YOUR_API_KEY.
Never expose API keys in client-side code. Use a server-side proxy to forward requests.
Session state management is not supportedThe current API does not support the server-side state management capability of the OpenAI Responses API.The following fields are not supported:
  • previous_response_id
  • conversation
This endpoint runs in a stateless mode. It does not store past responses, and subsequent requests do not automatically carry previous conversation context.To implement multi-turn conversations, maintain the message history on your side and explicitly pass the full context via the input parameter.

Quick example

Headers

Authorization
string
default:Bearer
required

API Key token (Bearer sk-xxx)

Content-Type
string
default:application/json
Example:

"application/json"

Body

application/json
input
required

Input content, can be a string or a list of input items.

model
string
required

Model ID, e.g. gpt-4o, gpt-5, etc.

context_management
object[]

Context management configuration.

max_output_tokens
integer<int64>

Maximum number of output tokens (including visible output and reasoning tokens).

max_tool_calls
integer<int64>

Maximum total number of built-in tool calls.

parallel_tool_calls
boolean

Whether to enable parallel tool calls.

previous_response_id
string

Previous response ID, used for multi-turn conversations.

prompt_cache_key
string

Prompt cache key, used to replace user to improve cache hit rate.

prompt_cache_retention
enum<string>

Prompt cache retention policy

Available options:
in_memory,
24h
safety_identifier
string

Safety identifier.

service_tier
enum<string>

{auto=auto, default=default, flex=flex, scale=scale, priority=priority}

Available options:
auto,
default,
flex,
scale,
priority
stream_options
object

Streaming response options, only set when {@code stream: true}.

tool_choice

Tool selection strategy: none, auto, required, or a tool selection object with type/name.

Available options:
none,
auto,
required
top_logprobs
integer<int64>

Number of most likely tokens to return per token position (0-20).

top_p
number

Nucleus sampling.

background
boolean

Whether to run the response in the background.

conversation
object

Associated conversation. Can be a conversation ID string or a conversation object with id {@link ResponseConversationParam}.

include
string[]

Additional data items to include.

instructions
string

System/developer instructions.

metadata
object

Metadata, up to 16 key-value pairs.

moderation
object

Content moderation configuration.

prompt
object

Reusable prompt template reference.

reasoning
object

Reasoning model configuration (gpt-5 and o-series models).

store
boolean
default:false

Whether to store the response.

stream
boolean
default:false

Whether to enable streaming output (native OpenAI Responses API field, also used for gateway streaming judgment).

temperature
number

Sampling temperature.

text
object

Text/structured output configuration, replaces the old response_format.

tools
object[]

Tool list, supports function, web_search_preview, file_search, computer_use_preview, etc.

OpenAI Responses API base tool definition. Supports multiple tool types including function, file_search, web_search_preview, etc.

truncation
enum<string>

{auto=auto, disabled=disabled}

Available options:
auto,
disabled
user
string

User identifier (deprecated, use safety_identifier / prompt_cache_key instead).

Response

200 - application/json
created_at
number

Creation time (Unix timestamp, seconds)

incomplete_details
object

Incomplete details

parallel_tool_calls
boolean

Whether to enable parallel tool calls

tool_choice

Tool selection strategy

Available options:
none,
auto,
required
top_p
number

Nucleus sampling

completed_at
number

Completion time (Unix timestamp, seconds)

max_output_tokens
integer<int64>

Maximum output token count

max_tool_calls
integer<int64>

Maximum total number of built-in tool calls

previous_response_id
string

Previous response ID

prompt_cache_key
string

Prompt cache key

prompt_cache_retention
enum<string>

{in_memory=in_memory, 24h=24h}

Available options:
in_memory,
24h
safety_identifier
string

Safety identifier

service_tier
enum<string>

{auto=auto, default=default, flex=flex, scale=scale, priority=priority}

Available options:
auto,
default,
flex,
scale,
priority
top_logprobs
integer<int64>

Number of most likely tokens to return per token position

id
string

Response unique ID

error
object

Error message

instructions

System/developer instructions. Can be a string or a list of input items.

metadata
object

Metadata, up to 16 key-value pairs

model
string

Model ID in use

object
string
default:response

Object type, always "response"

output
object[]

Output item list

temperature
number

Sampling temperature

tools
object[]

Tool list

OpenAI Responses API base tool definition. Supports multiple tool types including function, file_search, web_search_preview, etc.

background
boolean
default:false

Whether to run the response in the background

conversation
object

Associated conversation

moderation
object

Input/output content moderation configuration

prompt
object

Reusable prompt template reference

reasoning
object

Reasoning model configuration

status
enum<string>

{completed=completed, failed=failed, in_progress=in_progress, cancelled=cancelled, queued=queued, incomplete=incomplete}

Available options:
completed,
failed,
in_progress,
cancelled,
queued,
incomplete
text
object

Text/structured output configuration

truncation
enum<string>

{auto=auto, disabled=disabled}

Available options:
auto,
disabled
usage
object

Usage statistics

user
string

User identifier (deprecated)