I upgraded to livekit agents 1.2.9 and create an A...
# ask-ai
l
I upgraded to livekit agents 1.2.9 and create an AgentSession like:
Copy code
session = AgentSession(
    llm=openai.realtime.RealtimeModel(
        azure_deployment="gpt-realtime",
        api_key=os.environ.get("AZURE_OPENAI_API_KEY"),
        api_version="2024-10-01-preview",
        voice="marin",
        input_audio_transcription=realtime.AudioTranscription(
            model="whisper-1",
        ),
        input_audio_noise_reduction="near_field",
        turn_detection=realtime.realtime_audio_input_turn_detection.SemanticVad(
            type="semantic_vad",
            create_response=True,
            eagerness="auto",
            interrupt_response=True,
        ),
    )
)
I receive this error: agent-1 | 2025-09-16 090840,436 - ERROR livekit.plugins.openai - OpenAI Realtime API returned an error {"error": "RealtimeError(message=\"Unknown parameter: 'session.type'.\", type='invalid_request_error', code='unknown_parameter', event_id='tools_update_22e87d10545e', param='session.type')", "pid": 272, "job_id": "AJ_XWbd8536QKbi"} Where does this come from?
t
Thanks for reaching out, Dariush. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hi there! It looks like the error "Unknown parameter: 'session.type'" is happening because the OpenAI Realtime API doesn’t recognize 'session.type' as a valid parameter inside the session configuration. The 'type' field should actually be at the top level of your event objects (for example,
type: 'session.update'
), and not inside the nested 'session' object. To help you fix this, please make sure your session update events follow the right structure. Here’s an example for you:
Copy code
{
  "type": "session.update",
  "session": {
    "model": "gpt-4o-realtime-preview",
    "voice": "alloy"
  }
}
It’s a good idea to double-check your code to ensure 'type' isn’t accidentally placed inside the 'session' object. If you’d like, I’m here to help you through it—just let me know! Sources: plugins/openai/src/realtime/api_proto.ts | OpenAI Realtime API integration guide | LiveKit Docs