{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-openai/json-schema/microsoft-azure-openai-open-ai-realtime-session-create-request-schema.json",
  "title": "OpenAI.RealtimeSessionCreateRequest",
  "description": "A new Realtime session configuration, with an ephemeral key. Default TTL\nfor keys is one minute.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-openai-v1-openapi.yml#/components/schemas/OpenAI.RealtimeSessionCreateRequest",
  "type": "object",
  "required": [
    "client_secret"
  ],
  "properties": {
    "client_secret": {
      "allOf": [
        {
          "$ref": "#/$defs/OpenAI.RealtimeSessionCreateRequestClientSecret"
        }
      ],
      "description": "Ephemeral key returned by the API."
    },
    "modalities": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "text",
          "audio"
        ]
      },
      "description": "The set of modalities the model can respond with. To disable audio,\n  set this to [\"text\"].",
      "default": [
        "text",
        "audio"
      ]
    },
    "instructions": {
      "type": "string",
      "description": "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.\n  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": {
      "allOf": [
        {
          "$ref": "#/$defs/OpenAI.VoiceIdsOrCustomVoice"
        }
      ],
      "description": "The voice the model uses to respond. Supported built-in voices are\n  `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,\n  `marin`, and `cedar`. You may also provide a custom voice object with an\n  `id`, for example `{ \"id\": \"voice_1234\" }`. Voice cannot be changed during\n  the session once the model has responded with audio at least once."
    },
    "input_audio_format": {
      "type": "string",
      "description": "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`."
    },
    "output_audio_format": {
      "type": "string",
      "description": "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`."
    },
    "input_audio_transcription": {
      "allOf": [
        {
          "$ref": "#/$defs/OpenAI.RealtimeSessionCreateRequestInputAudioTranscription"
        }
      ],
      "description": "Configuration for input audio transcription, defaults to off and can be\n  set to `null` to turn off once on. Input audio transcription is not native\n  to the model, since the model consumes audio directly. Transcription runs\n  asynchronously and should be treated as rough guidance\n  rather than the representation understood by the model."
    },
    "speed": {
      "type": "number",
      "minimum": 0.25,
      "maximum": 1.5,
      "description": "The speed of the model's spoken response. 1.0 is the default speed. 0.25 is\n  the minimum speed. 1.5 is the maximum speed. This value can only be changed\n  in between model turns, not while a response is in progress.",
      "default": 1
    },
    "tracing": {
      "oneOf": [
        {
          "type": "string",
          "enum": [
            "auto"
          ]
        },
        {
          "type": "object",
          "properties": {
            "workflow_name": {
              "type": "string"
            },
            "group_id": {
              "type": "string"
            },
            "metadata": {
              "type": "object",
              "unevaluatedProperties": {}
            }
          }
        }
      ],
      "description": "Configuration options for tracing. Set to null to disable tracing. Once\n  tracing is enabled for a session, the configuration cannot be modified.\n  `auto` will create a trace for the session with default values for the\n  workflow name, group id, and metadata.",
      "title": "Tracing Configuration",
      "default": "auto"
    },
    "turn_detection": {
      "allOf": [
        {
          "$ref": "#/$defs/OpenAI.RealtimeSessionCreateRequestTurnDetection"
        }
      ],
      "description": "Configuration for turn detection. Can be set to `null` to turn off. Server\n  VAD means that the model will detect the start and end of speech based on\n  audio volume and respond at the end of user speech."
    },
    "tools": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/OpenAI.RealtimeSessionCreateRequestTools"
      },
      "description": "Tools (functions) available to the model."
    },
    "tool_choice": {
      "type": "string",
      "description": "How the model chooses tools. Options are `auto`, `none`, `required`, or\n  specify a function."
    },
    "temperature": {
      "type": "number",
      "description": "Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8."
    },
    "max_response_output_tokens": {
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string",
          "enum": [
            "inf"
          ]
        }
      ],
      "description": "Maximum number of output tokens for a single assistant response,\n  inclusive of tool calls. Provide an integer between 1 and 4096 to\n  limit output tokens, or `inf` for the maximum available tokens for a\n  given model. Defaults to `inf`."
    },
    "truncation": {
      "$ref": "#/$defs/OpenAI.RealtimeTruncation"
    },
    "prompt": {
      "$ref": "#/$defs/OpenAI.Prompt"
    }
  },
  "x-oaiMeta": {
    "name": "The session object",
    "group": "realtime"
  },
  "$defs": {
    "OpenAI.FileInputDetail": {
      "type": "string",
      "enum": [
        "low",
        "high"
      ]
    },
    "OpenAI.ImageDetail": {
      "type": "string",
      "enum": [
        "low",
        "high",
        "auto",
        "original"
      ]
    },
    "OpenAI.InputFileContent": {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "input_file"
          ],
          "description": "The type of the input item. Always `input_file`.",
          "x-stainless-const": true,
          "default": "input_file"
        },
        "file_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "filename": {
          "type": "string",
          "description": "The name of the file to be sent to the model."
        },
        "file_data": {
          "type": "string",
          "description": "The content of the file to be sent to the model."
        },
        "file_url": {
          "type": "string",
          "format": "uri",
          "description": "The URL of the file to be sent to the model."
        },
        "detail": {
          "allOf": [
            {
              "$ref": "#/$defs/OpenAI.FileInputDetail"
            }
          ],
          "description": "The detail level of the file to be sent to the model. Use `low` for the default rendering behavior, or `high` to render the file at higher quality. Defaults to `low`."
        }
      },
      "description": "A file input to the model.",
      "title": "Input file"
    },
    "OpenAI.InputImageContent": {
      "type": "object",
      "required": [
        "type",
        "detail"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "input_image"
          ],
          "description": "The type of the input item. Always `input_image`.",
          "x-stainless-const": true,
          "default": "input_image"
        },
        "image_url": {
          "anyOf": [
            {
              "type": "string",
              "format": "uri"
            },
            {
              "type": "null"
            }
          ]
        },
        "file_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "detail": {
          "allOf": [
            {
              "$ref": "#/$defs/OpenAI.ImageDetail"
            }
          ],
          "description": "The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`."
        }
      },
      "description": "An image input to the model. Learn about [image inputs](/docs/guides/vision).",
      "title": "Input image"
    },
    "OpenAI.InputTextContent": {
      "type": "object",
      "required": [
        "type",
        "text"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "input_text"
          ],
          "description": "The type of the input item. Always `input_text`.",
          "x-stainless-const": true,
          "default": "input_text"
        },
        "text": {
          "type": "string",
          "description": "The text input to the model."
        }
      },
      "description": "A text input to the model.",
      "title": "Input text"
    },
    "OpenAI.Prompt": {
      "type": "object",
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "The unique identifier of the prompt template to use."
        },
        "version": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "variables": {
          "anyOf": [
            {
              "$ref": "#/$defs/OpenAI.ResponsePromptVariables"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "description": "Reference to a prompt template and its variables.\n[Learn more](/docs/guides/text?api-mode=responses#reusable-prompts)."
    },
    "OpenAI.RealtimeSessionCreateRequestClientSecret": {
      "type": "object",
      "required": [
        "value",
        "expires_at"
      ],
      "properties": {
        "value": {
          "type": "string"
        },
        "expires_at": {
          "type": "integer",
          "format": "unixtime"
        }
      }
    },
    "OpenAI.RealtimeSessionCreateRequestInputAudioTranscription": {
      "type": "object",
      "properties": {
        "model": {
          "type": "string"
        }
      }
    },
    "OpenAI.RealtimeSessionCreateRequestTools": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "function"
          ],
          "x-stainless-const": true
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "parameters": {
          "$ref": "#/$defs/OpenAI.RealtimeSessionCreateRequestToolsParameters"
        }
      }
    },
    "OpenAI.RealtimeSessionCreateRequestToolsParameters": {
      "type": "object"
    },
    "OpenAI.RealtimeSessionCreateRequestTurnDetection": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string"
        },
        "threshold": {
          "type": "number"
        },
        "prefix_padding_ms": {
          "type": "integer"
        },
        "silence_duration_ms": {
          "type": "integer"
        }
      }
    },
    "OpenAI.RealtimeTruncation": {
      "oneOf": [
        {
          "type": "string",
          "enum": [
            "auto",
            "disabled"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "retention_ratio"
              ],
              "x-stainless-const": true
            },
            "retention_ratio": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "token_limits": {
              "$ref": "#/$defs/OpenAI.TokenLimits"
            }
          },
          "required": [
            "type",
            "retention_ratio"
          ]
        }
      ],
      "description": "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.\nClients can configure truncation behavior to truncate with a lower max token limit, which is an effective way to control token usage and cost.\nTruncation 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.\nTruncation 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.",
      "title": "Realtime Truncation Controls"
    },
    "OpenAI.ResponsePromptVariables": {
      "type": "object",
      "unevaluatedProperties": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "$ref": "#/$defs/OpenAI.InputTextContent"
          },
          {
            "$ref": "#/$defs/OpenAI.InputImageContent"
          },
          {
            "$ref": "#/$defs/OpenAI.InputFileContent"
          }
        ]
      },
      "description": "Optional map of values to substitute in for variables in your\nprompt. The substitution values can either be strings, or other\nResponse input types like images or files.",
      "title": "Prompt Variables",
      "x-oaiExpandable": true,
      "x-oaiTypeLabel": "map"
    },
    "OpenAI.TokenLimits": {
      "type": "object",
      "properties": {
        "post_instructions": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "OpenAI.VoiceIdsOrCustomVoice": {
      "anyOf": [
        {
          "$ref": "#/$defs/OpenAI.VoiceIdsShared"
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            }
          },
          "required": [
            "id"
          ]
        }
      ],
      "description": "A built-in voice name or a custom voice reference.",
      "title": "Voice"
    },
    "OpenAI.VoiceIdsShared": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "string",
          "enum": [
            "alloy",
            "ash",
            "ballad",
            "coral",
            "echo",
            "sage",
            "shimmer",
            "verse",
            "marin",
            "cedar"
          ]
        }
      ]
    }
  }
}