Models
Reference for the models config and the helpers for OpenAI, Anthropic, Google, Deepgram, Cartesia, ElevenLabs and AssemblyAI.
The models config picks the language model, speech to text and text to speech. Each slot takes a helper such as deepgram.stt({ model }), or a provider/model string. A helper returns a reference, never a client, and a key never goes in code: add the provider key under Connections in the dashboard.
Import from @voicelayer/sdk.
ModelsConfig
interface · @voicelayer/sdk
interface ModelsConfigWhich models the agent uses. Each slot takes a helper such as deepgram.stt({ model }), a provider/model string, or for llm a descriptor.
Fields
| Name | Type | Required | Description |
|---|---|---|---|
llm | string | ModelConfig | ModelDescriptor | no | The language model: openai.llm({ model }) and its siblings, a provider/model string, or a descriptor such as { provider, id }. |
stt | string | SttConfig | no | Speech to text: deepgram.stt({ model }) and its siblings, or a provider/model string. |
tts | string | VoiceConfig | no | Text to speech: deepgram.tts({ model }) and its siblings, or a provider/model string. |
realtime | RealtimeConfig | no | A speech-to-speech model (openai.realtime, google.realtime) that replaces the stt, llm and tts chain. |
turnDetection | 'vad' | 'model' | no | How the end of the caller's turn is found. model uses a turn-detection model chosen by language; vad listens for silence. |
language | string | no | The agent's main language as a BCP 47 tag such as en or gu-IN: the greeting, and the fallback when nothing is detected. |
additionalLanguages | readonly string[] | no | The other languages the agent serves. Callers may mix them; the agent follows them as languageSwitching says. |
languageSwitching | 'listed' | 'any' | 'off' | no | What happens when the caller speaks another language: listed (default) follows them among the listed languages, any follows them into any language the transcriber hears, off always answers in the main language. |
languageOverrides | Readonly<Record<string, { readonly voice?: VoiceConfig; readonly stt?: SttConfig; readonly firstMessage?: string }>> | no | Per listed language: voice, a different stt (used for the call's starting language) and the firstMessage greeting. Anything left out uses the agent's own. |
speechFallback | 'platform' | 'none' | no | Whether another speech provider takes over when the agent's own fails: platform or none. Left out, it depends on whose key the agent runs on. |
lineOverrides | Readonly<Record<string, Readonly<Record<string, string>>>> | no | The lines the platform speaks by itself, in your own words: language, then line id, then text. They win over the platform's own. |
decision | string | DecisionConfig | no | The model that makes the flow's routing decisions: a VoiceLayer decision-model id such as 'openai/gpt-6-luna-decisions', or { model }. Leave it out for the platform default. It always runs on VoiceLayer's keys and is free; declaring it here makes the dashboard's "Routing decisions" setting read-only. An id VoiceLayer does not offer is refused at upload. |
ModelDescriptor
interface · @voicelayer/sdk
interface ModelDescriptorNames a model the way the AI SDK does, in a form that can be saved: { provider: 'anthropic', id: 'claude-haiku-4-5' }. An AI SDK model such as anthropic('claude-…') is accepted in its place; only its provider and model id are read. The provider key stays in the workspace's Connections vault, so a descriptor carries none.
Fields
| Name | Type | Required | Description |
|---|---|---|---|
provider | 'openai' | 'anthropic' | 'google' | 'gemini' | (string & {}) | yes | The model provider, for example openai, anthropic or google. |
id | string | no | The provider's model id. |
modelId | string | no | The model id under the name the AI SDK uses; id and modelId mean the same. |
options | object | no | Sampling settings for the model. |
options.temperature | number | no | Sampling temperature. |
options.maxOutputTokens | number | no | The most tokens the model may produce in one reply. |
options.topP | number | no | Nucleus sampling cutoff. |
openai
namespace · @voicelayer/sdk
const openaiOpenAI models, for the llm, tts and realtime slots of models.
llm
openai.llm(options?: { model?, temperature?, maxOutputTokens?, topP? }): { provider: string; model: string; temperature?: number | undefined; maxOutputTokens?: number | undefined; topP?: number | undefined; }A language model from OpenAI.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
options | object | no | model and sampling settings. | |
options.model | string | no | 'gpt-4o-mini' | The model id. |
options.temperature | number | no | Sampling temperature. Lower is more predictable. | |
options.maxOutputTokens | number | no | The most tokens the model may produce in one reply. | |
options.topP | number | no | Nucleus sampling cutoff. |
Returns
{ provider: string; model: string; temperature?: number | undefined; maxOutputTokens?: number | undefined; topP?: number | undefined; }: A language-model reference for models.llm.
Throws
- TypeError when
apiKeyorbaseURLis passed: a key never travels in the agent's definition, so add the provider key under Connections in the dashboard.
Example
models: { llm: openai.llm({ model: 'gpt-4o-mini', temperature: 0.3 }) }tts
openai.tts(options?: { model?, voice? }): { provider: string; voiceId: string; model?: string | undefined; connectionId?: string | undefined; rate?: number | undefined; }Text to speech with OpenAI.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
options | object | no | model and voice. | |
options.model | string | no | 'tts-1' | The OpenAI speech model. |
options.voice | string | no | 'alloy' | The voice name. |
Returns
{ provider: string; voiceId: string; model?: string | undefined; connectionId?: string | undefined; rate?: number | undefined; }: A text-to-speech reference for models.tts.
Throws
- TypeError when
apiKeyorbaseURLis passed: a key never travels in the agent's definition, so add the provider key under Connections in the dashboard.
Example
models: { tts: openai.tts({ voice: 'alloy' }) }realtime
openai.realtime(options?: { model?, voice? }): { provider: string; model: string; temperature?: number | undefined; voice?: string | undefined; }A speech-to-speech model from OpenAI, which replaces the separate stt, llm and tts chain.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
options | object | no | model and voice. | |
options.model | string | no | 'gpt-4o-realtime-preview' | The realtime model id. |
options.voice | string | no | The voice name. |
Returns
{ provider: string; model: string; temperature?: number | undefined; voice?: string | undefined; }: A realtime reference for models.realtime.
Throws
- TypeError when
apiKeyorbaseURLis passed: a key never travels in the agent's definition, so add the provider key under Connections in the dashboard.
Example
models: { realtime: openai.realtime({ voice: 'alloy' }) }anthropic
namespace · @voicelayer/sdk
const anthropicAnthropic models, for the llm slot of models.
llm
anthropic.llm(options?: { model?, temperature?, maxOutputTokens?, topP? }): { provider: string; model: string; temperature?: number | undefined; maxOutputTokens?: number | undefined; topP?: number | undefined; }A language model from Anthropic.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
options | object | no | model and sampling settings. | |
options.model | string | no | 'claude-sonnet-5-5' | The model id. |
options.temperature | number | no | Sampling temperature. Lower is more predictable. | |
options.maxOutputTokens | number | no | The most tokens the model may produce in one reply. | |
options.topP | number | no | Nucleus sampling cutoff. |
Returns
{ provider: string; model: string; temperature?: number | undefined; maxOutputTokens?: number | undefined; topP?: number | undefined; }: A language-model reference for models.llm.
Throws
- TypeError when
apiKeyorbaseURLis passed: a key never travels in the agent's definition, so add the provider key under Connections in the dashboard.
Example
models: { llm: anthropic.llm({ model: 'claude-sonnet-5-5' }) }google
namespace · @voicelayer/sdk
const googleGoogle models, for the llm and realtime slots of models.
llm
google.llm(options?: { model?, temperature?, maxOutputTokens?, topP? }): { provider: string; model: string; temperature?: number | undefined; maxOutputTokens?: number | undefined; topP?: number | undefined; }A language model from Google (Gemini).
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
options | object | no | model and sampling settings. | |
options.model | string | no | 'gemini-3.8-flash' | The model id. |
options.temperature | number | no | Sampling temperature. Lower is more predictable. | |
options.maxOutputTokens | number | no | The most tokens the model may produce in one reply. | |
options.topP | number | no | Nucleus sampling cutoff. |
Returns
{ provider: string; model: string; temperature?: number | undefined; maxOutputTokens?: number | undefined; topP?: number | undefined; }: A language-model reference for models.llm.
Throws
- TypeError when
apiKeyorbaseURLis passed: a key never travels in the agent's definition, so add the provider key under Connections in the dashboard.
Example
models: { llm: google.llm({ model: 'gemini-3.8-flash' }) }realtime
google.realtime(options?: { model?, voice? }): { provider: string; model: string; temperature?: number | undefined; voice?: string | undefined; }A speech-to-speech model from Google, which replaces the separate stt, llm and tts chain.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
options | object | no | model and voice. | |
options.model | string | no | 'gemini-3.1-flash-live-preview' | The realtime model id. |
options.voice | string | no | The voice name. |
Returns
{ provider: string; model: string; temperature?: number | undefined; voice?: string | undefined; }: A realtime reference for models.realtime.
Throws
- TypeError when
apiKeyorbaseURLis passed: a key never travels in the agent's definition, so add the provider key under Connections in the dashboard.
Example
models: { realtime: google.realtime() }deepgram
namespace · @voicelayer/sdk
const deepgramDeepgram speech models, for the stt and tts slots of models.
stt
deepgram.stt(options?: { model?, language? }): { provider: string; model?: string | undefined; language?: string | undefined; endOfTurnConfidence?: number | undefined; endOfTurnTimeoutMs?: number | undefined; keywords?: string[] | undefined; connectionId?: string | undefined; }Speech to text with Deepgram.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
options | object | no | model and language. | |
options.model | string | no | 'nova-3' | The Deepgram model id. |
options.language | string | no | The spoken language as a BCP 47 code, such as en or es. |
Returns
{ provider: string; model?: string | undefined; language?: string | undefined; endOfTurnConfidence?: number | undefined; endOfTurnTimeoutMs?: number | undefined; keywords?: string[] | undefined; connectionId?: string | undefined; }: A speech-to-text reference for models.stt.
Throws
- TypeError when
apiKeyorbaseURLis passed: a key never travels in the agent's definition, so add the provider key under Connections in the dashboard.
Example
models: { stt: deepgram.stt({ model: 'nova-3', language: 'en' }) }tts
deepgram.tts(options?: { model? }): { provider: string; voiceId: string; model?: string | undefined; connectionId?: string | undefined; rate?: number | undefined; }Text to speech with Deepgram. The voice is part of the model id, such as aura-2-harmonia-en.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
options | object | no | model, the Deepgram voice model id. | |
options.model | string | no | 'aura-2-harmonia-en' | The Deepgram voice model id. |
Returns
{ provider: string; voiceId: string; model?: string | undefined; connectionId?: string | undefined; rate?: number | undefined; }: A text-to-speech reference for models.tts.
Throws
- TypeError when
apiKeyorbaseURLis passed: a key never travels in the agent's definition, so add the provider key under Connections in the dashboard.
Example
models: { tts: deepgram.tts({ model: 'aura-2-harmonia-en' }) }cartesia
namespace · @voicelayer/sdk
const cartesiaCartesia models, for the tts and stt slots of models.
tts
cartesia.tts(options?: { voice?, model? }): { provider: string; voiceId: string; model?: string | undefined; connectionId?: string | undefined; rate?: number | undefined; }Text to speech with Cartesia.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
options | object | no | voice, which is required, and model. |
options.voice | string | no | The Cartesia voice id. Required. |
options.model | string | no | The Cartesia model id. |
Returns
{ provider: string; voiceId: string; model?: string | undefined; connectionId?: string | undefined; rate?: number | undefined; }: A text-to-speech reference for models.tts.
Throws
- TypeError when
apiKeyorbaseURLis passed: a key never travels in the agent's definition, so add the provider key under Connections in the dashboard. - TypeError when
voiceis missing.
Example
models: { tts: cartesia.tts({ voice: 'your-voice-id' }) }stt
cartesia.stt(options?: { model?, language? }): { provider: string; model?: string | undefined; language?: string | undefined; endOfTurnConfidence?: number | undefined; endOfTurnTimeoutMs?: number | undefined; keywords?: string[] | undefined; connectionId?: string | undefined; }Speech to text with Cartesia.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
options | object | no | model and language. |
options.model | string | no | The Cartesia model id. |
options.language | string | no | The spoken language as a BCP 47 code. |
Returns
{ provider: string; model?: string | undefined; language?: string | undefined; endOfTurnConfidence?: number | undefined; endOfTurnTimeoutMs?: number | undefined; keywords?: string[] | undefined; connectionId?: string | undefined; }: A speech-to-text reference for models.stt.
Throws
- TypeError when
apiKeyorbaseURLis passed: a key never travels in the agent's definition, so add the provider key under Connections in the dashboard.
Example
models: { stt: cartesia.stt({ language: 'en' }) }elevenlabs
namespace · @voicelayer/sdk
const elevenlabsElevenLabs models, for the tts slot of models.
tts
elevenlabs.tts(options?: { voice?, model? }): { provider: string; voiceId: string; model?: string | undefined; connectionId?: string | undefined; rate?: number | undefined; }Text to speech with ElevenLabs.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
options | object | no | voice, which is required, and model. |
options.voice | string | no | The ElevenLabs voice id. Required. |
options.model | string | no | The ElevenLabs model id. |
Returns
{ provider: string; voiceId: string; model?: string | undefined; connectionId?: string | undefined; rate?: number | undefined; }: A text-to-speech reference for models.tts.
Throws
- TypeError when
apiKeyorbaseURLis passed: a key never travels in the agent's definition, so add the provider key under Connections in the dashboard. - TypeError when
voiceis missing.
Example
models: { tts: elevenlabs.tts({ voice: 'your-voice-id' }) }assemblyai
namespace · @voicelayer/sdk
const assemblyaiAssemblyAI models, for the stt slot of models.
stt
assemblyai.stt(options?: { language? }): { provider: string; model?: string | undefined; language?: string | undefined; endOfTurnConfidence?: number | undefined; endOfTurnTimeoutMs?: number | undefined; keywords?: string[] | undefined; connectionId?: string | undefined; }Speech to text with AssemblyAI.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
options | object | no | language. |
options.language | string | no | The spoken language as a BCP 47 code. |
Returns
{ provider: string; model?: string | undefined; language?: string | undefined; endOfTurnConfidence?: number | undefined; endOfTurnTimeoutMs?: number | undefined; keywords?: string[] | undefined; connectionId?: string | undefined; }: A speech-to-text reference for models.stt.
Throws
- TypeError when
apiKeyorbaseURLis passed: a key never travels in the agent's definition, so add the provider key under Connections in the dashboard.
Example
models: { stt: assemblyai.stt({ language: 'en' }) }