I am using the new grok API realtime, it says that...
# ask-ai
w
I am using the new grok API realtime, it says that Norwegian is one of the supported languages. In the documentation it says "Each language features natural pronunciation, appropriate intonation patterns, and culturally-aware speech rhythms. You can also specify a preferred language or accent in your system instructions for consistent multilingual experiences." how can i set it in system instructions?
t
Thanks for reaching out, Marius. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m responding to your question about how to set Norwegian (or a preferred accent) in the system instructions for the new Grok Realtime API. You set the preferred language and speaking style by including it in the agent’s system
instructions
. Example (Python):
Copy code
from livekit.agents import AgentSession
from livekit.plugins import xai

session = AgentSession(
    llm=xai.realtime.RealtimeModel(
        voice="Ara",
        instructions="You are a helpful assistant. Respond in Norwegian (Bokmål). Use natural pronunciation, appropriate intonation, and culturally-aware speech rhythms. Keep a friendly, conversational tone."
    ),
)
Notes: • Specify the language and any preferred variant (e.g., “Bokmål”) in plain text inside
instructions
. • Specific Norwegian dialect codes (like
nb-NO
) aren’t selectable here; use descriptive instructions instead. • If users will speak Norwegian, ensure your STT component supports Norwegian for accurate transcription. Would you like a short JS/TS example or a version that requests a particular accent (e.g., “Oslo accent”) in the instructions? Sources: xAI Grok Voice Agent API plugin | LiveKit docs
Thanks — I’m responding to the error you shared about
RealtimeModel.__init__()
rejecting the
instructions
argument and your goal to set Norwegian. What I’m seeing: your runtime error means the installed xAI plugin version doesn’t accept
instructions
on
xai.realtime.RealtimeModel
, even though the API supports language-setting via system instructions. To move forward I can help two ways — please pick one or provide the requested info: 1) Quick check & fix (recommended) • Run and share the output of:
Copy code
pip show livekit-agents livekit-plugins-xai
I’ll confirm if your versions lack the
instructions
parameter and give the exact upgrade command to install the release that includes it. 2) Immediate workaround (no SDK change) • Remove
instructions
from the
RealtimeModel
constructor and inject your language guidance at session start instead. Example pattern:
Copy code
session = AgentSession(llm=xai.realtime.RealtimeModel(voice="Ara"))
  await session.say("Fra nå av svarer jeg på norsk (Bokmål).")
• Or include a first-system message in your agent flow that instructs the model to respond in Norwegian and with the desired intonation. If you want, share the
pip show
output and the snippet where you construct
RealtimeModel
and I’ll give the exact upgrade or code change to apply. Sources: OpenAI Realtime API plugin guide | LiveKit docs | xAI and LiveKit | LiveKit docs | Gemini Live API plugin | LiveKit docs