/live/{providerAccount}/bedrock/... — not the WebSocket Live / Realtime API used by Gemini, OpenAI, and Azure.
Prerequisites
- An AWS Bedrock model account on TrueFoundry.
- A model with type Realtime and Bedrock model id such as
amazon.nova-2-sonic-v1:0(oramazon.nova-2-5-sonic). - IAM permission for bidirectional invoke on that model (see IAM below).
- Your TrueFoundry API key and the gateway streaming base URL.
Display name vs model id: TrueFoundry sanitizes
: in Bedrock ids for the UI display name (for example amazon.nova-2-sonic-v1-0). The streaming URL and Bedrock SDK still use the real model id with the colon (amazon.nova-2-sonic-v1:0).Streaming host: Self-hosted gateways often expose Nova Sonic on a dedicated TLS port (default 8443). Set
GATEWAY_BASE to that HTTPS origin (for example https://gateway.example.com:8443). On managed TrueFoundry, use the Bedrock streaming base URL for your tenant.Endpoint and auth
Set the Bedrock SDKendpoint_uri to {GATEWAY_BASE}/live/{providerAccount}/bedrock. The SDK appends /model/{modelId}/invoke-with-bidirectional-stream.
Legacy path
/bedrock-stream/{providerAccount}/model/{modelId}/invoke-with-bidirectional-stream is still accepted during transition. Prefer the /live/{providerAccount}/bedrock/... form.
The gateway authenticates you with the TrueFoundry API key, then signs upstream Bedrock traffic with the provider account’s AWS credentials (SigV4 or Bedrock API key).
Request/response bodies are AWS EventStream frames. Chunk payloads are JSON with a base64
bytes field; each frame’s :content-type must be application/json (not application/octet-stream), or Bedrock returns modelStreamErrorException.
Add the model
- Open your Bedrock model account → add a model.
- Set Model ID to the Bedrock id (for example
amazon.nova-2-sonic-v1:0). - Set Model type to Realtime.
- Save. Use the account name as
{providerAccount}and the Bedrock model id as{modelId}in the path (URL-encode:as%3Aif you build the URL by hand).
Code example (Python)
Requires Python 3.12+. Uses the experimental Bedrock Runtime SDK against the gateway streaming base. Authenticate with your TrueFoundry API key viaAWS_BEARER_TOKEN_BEDROCK (same header shape as Bedrock API keys).
Python
Session shape (high level)
Nova Sonic expects an ordered EventStream of JSON events, including:sessionStart→promptStart- Optional system
TEXT(contentStart/textInput/contentEnd) - User
AUDIO(contentStart/audioInputchunks /contentEnd) — at least one audio content is required - After the turn:
promptEnd→sessionEnd
IAM
Grant the Bedrock identity used by your provider account permission to invoke bidirectional streams, for example:JSON
Limitations
- Shares the
/live/{account}/...URL prefix with other realtime providers, but uses HTTP/2 EventStream, not a WebSocket upgrade. Do not point OpenAI/Gemini Live SDKs at the Nova Sonic path. - Clients must speak AWS EventStream (HTTP/2). Ordinary REST/SSE clients and most Postman setups cannot drive a full duplex session; use the Bedrock Runtime SDK or an HTTP/2 EventStream client.
- Tool calling for Nova Sonic follows Bedrock’s native schema, not the OpenAI Realtime tool-calling examples on the Live API pages.