buildSessionUpdate (realtime/session-update.ts)

TanStack/ai · packages/ai-openai/src/realtime/session-update.ts · typescript · MIT
realtime

Transforms session config into OpenAI realtime API session.update payloads.

// Source: https://github.com/TanStack/ai | License: MIT | Copyright 2025 Tanner Linsley
// Provided via justclaw.it.com; keep this notice with the code.
import type { RealtimeSessionConfig } from '@tanstack/ai'

/**
 * Builds the GA-shaped `session.update` payload for OpenAI's realtime API.
 *
 * The GA API requires `session.type` on every update and nests audio
 * settings under `audio.input` / `audio.output` (the flat Beta field names
 * were retired when the Beta shape was shut down on 2026-05-12). A
 * `session.update` containing unknown fields is rejected with
 * `unknown_parameter` and none of the config is applied, so the exact field
 * names here are load-bearing.
 *
 * `temperature` was removed from the GA session config and is intentionally
 * never sent; the adapter logs when i

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key