Skip to main content
POST
Create Codex Response

Multimodal Input

Supports mixed text, image, and file inputs in a single message.

Reasoning Control

Adjustable reasoning effort from minimal to xhigh.

Tools & Web Search

Integrates web search or custom function calling tools.

Unified Endpoint

Uses the unified /api/v1/responses endpoint with model set to one of gpt-5-codex, gpt-5.1-codex, gpt-5.2-codex, or gpt-5.3-codex.

Tools & tool_choice

The tools array enables web search or function calling capabilities.
Web Search and Function Calling are mutually exclusive.
In a single request you should choose only one: do not include both {"type": "web_search"} and {"type": "function", ...} in the same tools array.
Use the built-in Web Search tool to retrieve up-to-date information:
Define business functions that the model can call when needed:
When function tools are configured in tools, set tool_choice to "auto" so the model can decide when to call them.
If you do not configure any function tools, omit the tool_choice field.

Authorizations

Authorization
string
header
required

All APIs require authentication via Bearer Token.

Get API Key:

  1. Visit API Key Management Page to get your API Key

Usage: Add to request header: Authorization: Bearer YOUR_API_KEY

Note:

  • Keep your API Key secure and do not share it with others
  • If you suspect your API Key has been compromised, reset it immediately in the management page

Body

application/json
model
enum<string>
required

Target model name. Allowed values: gpt-5-codex, gpt-5.1-codex, gpt-5.2-codex, gpt-5.3-codex.

Available options:
gpt-5-codex,
gpt-5.1-codex,
gpt-5.2-codex,
gpt-5.3-codex
Example:

"gpt-5.1-codex"

input
required

Input can be a string.

reasoning
object

Reasoning configuration for the model.

tools
object[]

Optional tools that the model may call. Either web search OR function calling should be configured, but not both simultaneously.

Web search tool configuration.

tool_choice
string

Tool selection behavior. When function tools are configured in tools, set this to auto so the model can decide when to call them.

Example:

"auto"

Response

Request successful. Responses are only available as streaming Server-Sent Events (SSE).

Streaming responses are sent as Server-Sent Events (SSE) with Content-Type: text/event-stream.

Standard output

  • Text delta event: event: response.output_text.delta
    • data.delta: The incremental text content in the stream
    • data.type: Event type, always response.output_text.delta
  • Completion event: event: response.completed
    • data.response.usage: Token usage information, such as input_tokens and output_tokens

Function Calling

  • Function call arguments delta event: event: response.function_call_arguments.delta
    • data.delta: Incremental string content of the function call arguments
    • data.type: Event type, always response.function_call_arguments.delta
  • Completion event: event: response.completed
    • data.response.usage: Token usage information, such as input_tokens and output_tokens

The final line data: [DONE] is the stream end marker, indicating that no more events will be sent.