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.created → response.output_audio.delta → response.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.createafter a force message starts an extra model turn on top of the scripted line. - Use
interruptible: falsefor compliance lines that must finish; leave defaulttruefor barge-in greetings. - Console API credits are separate from SuperGrok's weekly pool on grok.com.