modern-winter-66316
12/04/2025, 10:30 PMtall-airline-16756
12/04/2025, 10:30 PMtall-airline-16756
12/04/2025, 10:31 PMmodern-winter-66316
12/04/2025, 10:35 PMtall-airline-16756
12/04/2025, 10:36 PM"openai/gpt-4.1-mini", "elevenlabs/aura-1:Rachel", "deepgram/nova-2"). Do not instantiate provider plugin classes or include provider API keys in your code.
What to do (step‑by‑step)
1. Configure your agent/session with model strings for STT, LLM, and TTS:
◦ Example:
from livekit.agents import AgentSession
session = AgentSession(
stt="deepgram/nova-2",
llm="openai/gpt-4.1-mini",
tts="elevenlabs/aura-1:Rachel",
)
1. Ensure only your LiveKit API key is used for authentication when calling LiveKit endpoints. Do not store or use provider-specific API keys in the builder or runtime.
2. Do NOT instantiate provider plugin classes (these require your provider keys). Avoid code like:
from livekit.plugins import openai, elevenlabs
# ❌ Avoid this — uses customer provider keys
llm = openai.LLM(model="gpt-4.1-mini")
tts = elevenlabs.TTS(voice="Rachel")
1. When you need to change providers or try different models, switch the model string only (no key changes). Example alternatives:
◦ LLMs: "google/gemini-2.5-flash", "openai/gpt-4.1-mini"
◦ STT: "assemblyai/...", "deepgram/nova-2"
◦ TTS: "elevenlabs/aura-1:Rachel", "cartesia/..."
How to validate you’re using LiveKit Inference
• Confirm usage and billing appear in the LiveKit dashboard and on LiveKit invoices (not separate provider invoices).
• Confirm code contains model strings and no provider key files or plugin instantiations.
Short checklist to share with your builder team
• [ ] Use model strings in AgentSession (STT/LLM/TTS)
• [ ] Only use the LiveKit API key for auth
• [ ] Remove any provider API keys from code/config
• [ ] Do not instantiate provider plugin classes
• [ ] Test switching providers by changing model strings only
If you want, I can:
• Draft a short policy snippet or README entry your builders can add to the repo.
• Provide additional code examples for Node/Python or CI checks to enforce no provider keys in the repo. Which would you prefer? Sources: Models | LiveKit Docs | Speech-to-text (STT) models | LiveKit Docs | Large language models (LLM) | LiveKit Docs | Text-to-speech (TTS) models | LiveKit Docs | Introducing LiveKit Inference: A unified model interface for voice AImodern-winter-66316
12/04/2025, 11:04 PMtall-airline-16756
12/04/2025, 11:05 PMmodern-winter-66316
12/04/2025, 11:06 PMtall-airline-16756
12/04/2025, 11:07 PMaccent parameter. Use voice selection + prompt/instructions to influence style, and SSML (with Google Cloud TTS) for finer phonetic control. Below are concise Python examples and practical tips.
1) OpenAI Realtime voice (LiveKit)
from livekit.plugins import openai
from livekit.agents import AgentSession
session = AgentSession(
llm=openai.realtime.RealtimeModel(
voice="ash", # choose a predefined voice name
temperature=0.6,
modalities=["audio", "text"],
),
)
# Use LLM instructions to nudge style:
# e.g., include in agent instructions: "Speak with a brisk, direct New York style."
2) Google Gemini Live voice (LiveKit) — use instructions to influence delivery
from livekit.plugins import google
from livekit.agents import AgentSession
session = AgentSession(
llm=google.realtime.RealtimeModel(
model="gemini-2.0-flash",
voice="Puck", # choose a Gemini voice
temperature=0.7,
instructions="Speak confidently with a quick, direct East Coast delivery (subtle NY-style cadence).",
),
)
3) If you need more precise accent/pronunciation control — Google Cloud TTS + SSML (not realtime Gemini)
from livekit.plugins import google
from livekit.agents import AgentSession
session = AgentSession(
tts=google.TTS(
language="en-US",
voice_name="en-US-Wavenet-D", # pick a US voice with desired character
)
)
# Use SSML when sending text to synthesize:
ssml = """
<speak>
<prosody rate="fast" pitch="+0st">
Hello — this is an example phrasing with a brisk, streetwise New York delivery.
</prosody>
</speak>
"""
# send ssml as the TTS input where supported
Practical tips
• Choose voices that naturally sound closer to the target accent; voice names imply styles but do not map 1:1 to regional accents.
• Use instructions (Gemini) or agent prompt engineering to request a NY accent or other regional traits—this often yields reasonable approximations.
• Use SSML (Google Cloud TTS) for phonetic and prosody tweaks for finer control; SSML is not guaranteed in realtime Gemini/OpenAI.
• Test multiple voice names and instruction wordings; accents are approximated by voice model + prompt, not a dedicated accent parameter.
If you want, I can:
• Produce a short agent instruction template that prompts for a New York accent.
• Give a Node.js equivalent or a test script to compare voices side-by-side. Which would you prefer? Sources: Google Cloud TTS integration guide | LiveKit Docs