stale-twilight-16515
12/05/2025, 1:43 PMtall-airline-16756
12/05/2025, 1:43 PMtall-airline-16756
12/05/2025, 1:43 PMuv add "livekit-plugins-aws[realtime]"
1. Set AWS credentials in your `.env`:
AWS_ACCESS_KEY_ID=<your-aws-access-key-id>
AWS_SECRET_ACCESS_KEY=<your-aws-secret-access-key>
1. Create an AgentSession using the realtime model:
from livekit.plugins import aws
session = AgentSession(
llm=aws.realtime.RealtimeModel(),
)
1. Optionally set voice and `region`:
session = AgentSession(
llm=aws.realtime.RealtimeModel(
voice="Sarah",
region="us-west-2"
),
)
Notes:
• Nova Sonic’s VAD-based turn detection is used for realtime interactions.
• If by "Nova Sonic 2" you mean a newer AWS model/version, that specific name isn't listed in LiveKit docs. If you can share the exact model name or a link, I can check whether it maps to the supported Nova Sonic integration and show exact parameters to pass. Sources: Amazon Nova Sonic integration guide | LiveKit docs | AWS AI and LiveKit | LiveKit Docsstale-twilight-16515
12/05/2025, 1:44 PMtall-airline-16756
12/05/2025, 1:44 PMmodel_id for Nova Sonic.
You cannot change Nova Sonic's underlying model_id in LiveKit — Nova Sonic is a single realtime speech-to-speech model. You can only customize parameters such as voice and region:
from livekit.plugins import aws
session = AgentSession(
llm=aws.realtime.RealtimeModel(
voice="Rachel",
region="us-west-2",
),
)
If you need to use a different model_id (a different TTS/STS model or provider), tell me which model or provider you want to use (for example Cartesia, Rime, or a specific AWS Bedrock model name). I can then show which LiveKit plugin supports passing model_id and the exact parameters to use. Would you like that?
Sources: Amazon Nova Sonic integration guide | LiveKit docsfresh-king-31634
12/06/2025, 12:00 PMtall-airline-16756
12/06/2025, 12:00 PMmodel.model_id can work short-term, but it’s not an officially supported configuration path. That means future plugin changes could break the tweak.
• Using a different Bedrock model name may change how input/output are tokenized or billed, which explains the slightly higher token usage you observed.
• If you want a safer approach, I can:
◦ Show how to wrap RealtimeModel in a small helper that sets model_id reliably for your project, or
◦ Recommend alternative plugins/providers that officially accept model_id if you need stable, supported model switching.
Which option would you prefer, or do you want the helper code now?fresh-king-31634
12/06/2025, 12:04 PMRealtimeModel in a small helper that sets model_id reliably for your projecttall-airline-16756
12/06/2025, 12:04 PMRealtimeModel and reliably sets model_id. Below is a concise Python wrapper you can add to your project to avoid monkey-patching while keeping the change localized and easier to maintain.
from livekit.plugins import aws
class RealtimeModelWithId(aws.realtime.RealtimeModel):
"""
Wrapper around aws.realtime.RealtimeModel that ensures a custom model_id
is set at initialization time (instead of monkey-patching later).
"""
def __init__(self, *args, model_id: str | None = None, **kwargs):
# Pass through other args/kwargs to base implementation
super().__init__(*args, **kwargs)
# If a custom model_id is provided, store it on the instance.
# This mirrors what monkey-patching did but keeps it explicit.
if model_id is not None:
self.model_id = model_id
# Optional: if the plugin uses an internal method to build request params,
# override it to ensure model_id is included. Example placeholder:
def _build_request_params(self, *args, **kwargs):
params = super()._build_request_params(*args, **kwargs)
# Ensure model_id present in the params if set on the instance
if hasattr(self, "model_id"):
params["model_id"] = getattr(self, "model_id")
return params
Usage:
model = RealtimeModelWithId(model_id="amazon.nova-2-sonic-v1:0", voice="Rachel", region="us-west-2")
session = AgentSession(llm=model)
Caveats and notes:
• This wrapper keeps the change explicit and local; it’s easier to update if the plugin internals change.
• If the plugin constructs Bedrock requests in a different internal method name than _build_request_params, replace that method override with the correct internal hook used by the plugin. If you want, share the RealtimeModel source you inspected and I’ll adapt the override to the exact method names.
• Expect potential differences in tokenization/billing when using non-default Bedrock model names.