POST
POST /realtime/sessions — OpenAI API
OpenAI API key (required); https://api.openai.com/v1
OpenAI APICreate session
- Base URL
- https://api.openai.com/v1
- Auth
- Authorization: Bearer <OPENAI_API_KEY>
- Last verified
- 2026-10-20 · upstream hash matched
Actions Try in browser→
Agents: curl -H "Accept: text/markdown" this URL
→ 396 tokens · Vary: Accept
→ 396 tokens · Vary: Accept
Critical gotchas
The Responses API is the primary interface for new text and tool workflows; Chat Completions remains a separate compatibility API.
Audio transcription uploads use multipart form data rather than a JSON request body.
cURL
curl -X POST 'https://api.openai.com/v1/realtime/sessions' \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "client_secret": { "value": "example-value", "expires_at": 0 }}'
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| client_secret | body | object | Yes | Ephemeral key returned by the API. |
| modalities | body | string[] | No | The set of modalities the model can respond with. To disable audio, set this to ["text"]. |
| instructions | body | string | No | The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior. Note that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session. |
| voice | body | string | No | A built-in voice name or a custom voice reference. |
| input_audio_format | body | string | No | The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. |
| output_audio_format | body | string | No | The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. |
| input_audio_transcription | body | object | No | Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously and should be treated as rough guidance rather than the representation understood by the model. |
| speed | body | number | No | The speed of the model's spoken response. 1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress. |
| tracing | body | string | No | Configuration options for tracing. Set to null to disable tracing. Once tracing is enabled for a session, the configuration cannot be modified. `auto` will create a trace for the session with default values for the workflow name, group id, and metadata. |
| turn_detection | body | object | No | Configuration for turn detection. Can be set to `null` to turn off. Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech. |
| tools | body | object[] | No | Tools (functions) available to the model. |
| tool_choice | body | string | No | How the model chooses tools. Options are `auto`, `none`, `required`, or specify a function. |
| temperature | body | number | No | Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. |
| max_response_output_tokens | body | integer | No | Maximum number of output tokens for a single assistant response, inclusive of tool calls. Provide an integer between 1 and 4096 to limit output tokens, or `inf` for the maximum available tokens for a given model. Defaults to `inf`. |
| truncation | body | string | No | When the number of tokens in a conversation exceeds the model's input token limit, the conversation be truncated, meaning messages (starting from the oldest) will not be included in the model's context. A 32k context model with 4,096 max output tokens can only include 28,224 tokens in the context before truncation occurs. Clients can configure truncation behavior to truncate with a lower max token limit, which is an effective way to control token usage and cost. Truncation will reduce the number of cached tokens on the next turn (busting the cache), since messages are dropped from the beginning of the context. However, clients can also configure truncation to retain messages up to a fraction of the maximum context size, which will reduce the need for future truncations and thus improve the cache rate. Truncation can be disabled entirely, which means the server will never truncate but would instead return an error if the conversation exceeds the model's input token limit. |
| prompt | body | object | No | Reference to a prompt template and its variables. [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). |
Response 200 OK
{
"id": "string",
"object": "string",
"expires_at": 0,
"include": [
"item.input_audio_transcription.logprobs"
],
"model": "string",
"output_modalities": {},
"instructions": "string",
"audio": {
"input": {
"format": {
"type": "audio/pcm",
"rate": 24000
},
"transcription": {
"model": "string",
"language": "string",
"languages": [
"string"
],
"prompt": "string"
},
"noise_reduction": {
"type": "near_field"
},
"turn_detection": {
"type": "string",
"threshold": 0,
"prefix_padding_ms": 0,
"silence_duration_ms": 0
}
},
"output": {
"format": {
"type": "audio/pcm",
"rate": 24000
},
"voice": "ash",
"speed": 0
}
},
"tracing": "auto",
"turn_detection": {
"type": "string",
"threshold": 0,
"prefix_padding_ms": 0,
"silence_duration_ms": 0
},
"tools": [
{
"type": "function",
"name": "string",
"description": "string",
"parameters": {}
}
],
"tool_choice": "string",
"max_output_tokens": 0
} Get a free OpenAI API key → sponsored Affiliate link - we may earn a commission, at no extra cost to you.