Calls
Accept call
$ openai realtime:calls accept
post /realtime/calls/{call_id}/accept
Accept an incoming SIP call and configure the realtime session that will handle it.
Parameters
-
--call-id: stringThe identifier for the call provided in the
realtime.call.incomingwebhook. -
--type: "realtime"The type of session to create. Always
realtimefor the Realtime API. -
--audio: optional object { input, output }Configuration for input and output audio.
-
--include: optional array of "item.input_audio_transcription.logprobs"Additional fields to include in server outputs.
item.input_audio_transcription.logprobs: Include logprobs for input audio transcription. -
--instructions: optional stringThe 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.createdevent at the start of the session. -
--max-output-tokens: optional number or "inf"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
inffor the maximum available tokens for a given model. Defaults toinf. -
--model: optional string or "gpt-realtime" or "gpt-realtime-1.5" or "gpt-realtime-2" or 14 moreThe Realtime model used for this session.
-
--output-modality: optional array of "text" or "audio"The set of modalities the model can respond with. It defaults to
["audio"], indicating that the model will respond with audio plus a transcript.["text"]can be used to make the model respond with text only. It is not possible to request bothtextandaudioat the same time. -
--parallel-tool-calls: optional booleanWhether the model may call multiple tools in parallel. Only supported by reasoning Realtime models such as
gpt-realtime-2. -
--prompt: optional object { id, variables, version }Reference to a prompt template and its variables. Learn more.
-
--reasoning: optional object { effort }Configuration for reasoning-capable Realtime models such as
gpt-realtime-2. -
--tool-choice: optional ToolChoiceOptions or ToolChoiceFunction or ToolChoiceMcpHow the model chooses tools. Provide one of the string modes or force a specific function/MCP tool.
-
--tool: optional array of RealtimeToolsConfigUnionTools available to the model.
-
--tracing: optional "auto" or object { group_id, metadata, workflow_name }Realtime API can write session traces to the Traces Dashboard. Set to null to disable tracing. Once tracing is enabled for a session, the configuration cannot be modified.
autowill create a trace for the session with default values for the workflow name, group id, and metadata. -
--truncation: optional "auto" or "disabled" or RealtimeTruncationRetentionRatioWhen 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.
Example
openai realtime:calls accept \
--api-key 'My API Key' \
--call-id call_id \
--type realtime
Hang up call
$ openai realtime:calls hangup
post /realtime/calls/{call_id}/hangup
End an active Realtime API call, whether it was initiated over SIP or WebRTC.
Parameters
-
--call-id: stringThe identifier for the call. For SIP calls, use the value provided in the
realtime.call.incomingwebhook. For WebRTC sessions, reuse the call ID returned in theLocationheader when creating the call withPOST /v1/realtime/calls.
Example
openai realtime:calls hangup \
--api-key 'My API Key' \
--call-id call_id
Refer call
$ openai realtime:calls refer
post /realtime/calls/{call_id}/refer
Transfer an active SIP call to a new destination using the SIP REFER verb.
Parameters
-
--call-id: stringThe identifier for the call provided in the
realtime.call.incomingwebhook. -
--target-uri: stringURI that should appear in the SIP Refer-To header. Supports values like
tel:+14155550123orsip:agent@example.com.
Example
openai realtime:calls refer \
--api-key 'My API Key' \
--call-id call_id \
--target-uri tel:+14155550123
Reject call
$ openai realtime:calls reject
post /realtime/calls/{call_id}/reject
Decline an incoming SIP call by returning a SIP status code to the caller.
Parameters
-
--call-id: stringThe identifier for the call provided in the
realtime.call.incomingwebhook. -
--status-code: optional numberSIP response code to send back to the caller. Defaults to
603(Decline) when omitted.
Example
openai realtime:calls reject \
--api-key 'My API Key' \
--call-id call_id