{"record":{"id":"a7b3e3880e2eb66b","repo":"microsoft/semantic-kernel","slug":"the-openai-realtime-model-id-is-required","errorCode":null,"errorMessage":"The OpenAI realtime model ID is required.","messagePattern":"The OpenAI realtime model ID is required\\.","errorType":"exception","errorClass":"ServiceInitializationError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/ai/open_ai/services/azure_realtime.py","lineNumber":126,"sourceCode":"                settings (OpenAIRealtimeExecutionSettings): the settings to use for the session\n                chat_history (ChatHistory): the chat history to use for the session\n                Otherwise they can also be passed to the context manager.\n        \"\"\"\n        try:\n            azure_openai_settings = AzureOpenAISettings(\n                api_key=api_key,\n                base_url=base_url,\n                endpoint=endpoint,\n                realtime_deployment_name=deployment_name,\n                api_version=api_version,\n                token_endpoint=token_endpoint,\n                env_file_path=env_file_path,\n                env_file_encoding=env_file_encoding,\n            )\n        except ValidationError as ex:\n            raise ServiceInitializationError(\"Failed to create OpenAI settings.\", ex) from ex\n        if not azure_openai_settings.realtime_deployment_name:\n            raise ServiceInitializationError(\"The OpenAI realtime model ID is required.\")\n        super().__init__(\n            api_key=azure_openai_settings.api_key.get_secret_value() if azure_openai_settings.api_key else None,\n            audio_output_callback=audio_output_callback,\n            deployment_name=azure_openai_settings.realtime_deployment_name,\n            endpoint=azure_openai_settings.endpoint,\n            base_url=azure_openai_settings.base_url,\n            api_version=azure_openai_settings.api_version,\n            ad_token=ad_token,\n            ad_token_provider=ad_token_provider,\n            token_endpoint=azure_openai_settings.token_endpoint,\n            ai_model_type=OpenAIModelTypes.REALTIME,\n            service_id=service_id,\n            default_headers=default_headers,\n            client=async_client,\n            websocket_base_url=websocket_base_url,\n            credential=credential,\n            **kwargs,\n        )","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/ai/open_ai/services/azure_realtime.py#L108-L144","documentation":"Raised by AzureRealtimeWebsocket.__init__ after AzureOpenAISettings is successfully created. The settings object's realtime_deployment_name field (loaded from the AZURE_OPENAI_REALTIME_DEPLOYMENT_NAME env var or the deployment_name constructor argument) is checked for truthiness. If it is None or empty, the service has no model deployment target for the Realtime API and cannot proceed.","triggerScenarios":"Constructing AzureRealtimeWebsocket without passing deployment_name= and without AZURE_OPENAI_REALTIME_DEPLOYMENT_NAME set in the environment or .env file. The settings were otherwise valid (endpoint, auth resolved), but the deployment identifier is missing.","commonSituations":"Using AZURE_OPENAI_DEPLOYMENT_NAME (generic) instead of AZURE_OPENAI_REALTIME_DEPLOYMENT_NAME (specific); .env file present but the realtime deployment variable line was commented out; switching from preview realtime (which used a different env var) to GA.","solutions":["Pass deployment_name= explicitly in the constructor: AzureRealtimeWebsocket(deployment_name='my-realtime-deployment', ...).","Set the AZURE_OPENAI_REALTIME_DEPLOYMENT_NAME environment variable to your Azure OpenAI realtime deployment name.","Verify the deployment exists in Azure Portal under Resource Management > Deployments and that its name matches exactly."],"exampleFix":"# before\nservice = AzureRealtimeWebsocket(\n    endpoint='https://myresource.openai.azure.com',\n    api_key='...',\n)\n# after\nservice = AzureRealtimeWebsocket(\n    deployment_name='gpt-4o-realtime',\n    endpoint='https://myresource.openai.azure.com',\n    api_key='...',\n)","handlingStrategy":"validation","validationCode":"import os\n\ndeployment_name = os.environ.get('AZURE_OPENAI_REALTIME_DEPLOYMENT_NAME')\nif not deployment_name:\n    raise ValueError(\n        'AZURE_OPENAI_REALTIME_DEPLOYMENT_NAME is not set. '\n        'Set it in your environment or .env file, or pass deployment_name= to the constructor.'\n    )","typeGuard":null,"tryCatchPattern":"from semantic_kernel.exceptions.service_exceptions import ServiceInitializationError\n\ntry:\n    service = AzureRealtimeWebsocket(\n        deployment_name=os.environ.get('AZURE_OPENAI_REALTIME_DEPLOYMENT_NAME'),\n        endpoint='https://myresource.openai.azure.com',\n        api_key='...',\n    )\nexcept ServiceInitializationError as e:\n    if 'realtime model ID is required' in str(e):\n        print('Set AZURE_OPENAI_REALTIME_DEPLOYMENT_NAME or pass deployment_name=')\n    raise","preventionTips":["Set AZURE_OPENAI_REALTIME_DEPLOYMENT_NAME in your .env file.","Always pass deployment_name= explicitly in the constructor for clarity.","Verify the deployment name exists in Azure Portal > Resource Management > Deployments.","Use deployment-specific env var names (not a generic AZURE_OPENAI_DEPLOYMENT_NAME)."],"tags":["azure-openai","realtime","deployment-name","websocket","env-vars"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}