VOICE / force-a-scripted-voice-line

Voice

Force a scripted voice line

Force a scripted voice line

Send conversation.item.create with item.type: "force_message" to TTS a verbatim line (greeting, disclosure, IVR prompt) without calling the model — and do not follow with response.create.

Send the force turn

import json

await ws.send(json.dumps({
    "type": "conversation.item.create",
    "item": {
        "type": "force_message",
        "role": "assistant",
        "interruptible": False,
        "content": [{"type": "output_text", "text": "This call is being recorded."}],
    },
}))
# Do NOT send response.create — the force_message IS the turn.

The server still emits a normal response lifecycle (response.createdresponse.output_audio.deltaresponse.done), so clients treat it like a model turn for playback.

Fields

Field Required Default Meaning
item.type yes Must be "force_message"
item.content[].text yes Verbatim text for TTS
item.interruptible no true When false, caller audio is dropped until playback finishes

Compatibility note

force_message is an xAI extension on the Realtime-compatible Speech to Speech API. Shared OpenAI Realtime clients need an xAI-specific branch for this event.

Pitfalls

  • Sending response.create after a force message starts an extra model turn on top of the scripted line.
  • Use interruptible: false for compliance lines that must finish; leave default true for barge-in greetings.
  • Console API credits are separate from SuperGrok's weekly pool on grok.com.