{"record":{"id":"081345f16b01bfd9","repo":"microsoft/semantic-kernel","slug":"the-openai-audio-to-text-model-id-is-required","errorCode":null,"errorMessage":"The OpenAI audio to text model ID is required.","messagePattern":"The OpenAI audio to text model ID is required\\.","errorType":"exception","errorClass":"ServiceInitializationError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/ai/open_ai/services/open_ai_audio_to_text.py","lineNumber":60,"sourceCode":"            default_headers: The default headers mapping of string keys to\n                string values for HTTP requests. (Optional)\n            async_client: An existing client to use. (Optional)\n            env_file_path: Use the environment settings file as\n                a fallback to environment variables. (Optional)\n            env_file_encoding: The encoding of the environment settings file. (Optional)\n        \"\"\"\n        try:\n            openai_settings = OpenAISettings(\n                api_key=api_key,\n                org_id=org_id,\n                audio_to_text_model_id=ai_model_id,\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 openai_settings.audio_to_text_model_id:\n            raise ServiceInitializationError(\"The OpenAI audio to text model ID is required.\")\n        super().__init__(\n            ai_model_id=openai_settings.audio_to_text_model_id,\n            api_key=openai_settings.api_key.get_secret_value() if openai_settings.api_key else None,\n            ai_model_type=OpenAIModelTypes.AUDIO_TO_TEXT,\n            org_id=openai_settings.org_id,\n            service_id=service_id,\n            default_headers=default_headers,\n            client=async_client,\n        )\n\n    @classmethod\n    def from_dict(cls: type[T_], settings: dict[str, Any]) -> T_:\n        \"\"\"Initialize an Open AI service from a dictionary of settings.\n\n        Args:\n            settings: A dictionary of settings for the service.\n        \"\"\"\n        return cls(","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/ai/open_ai/services/open_ai_audio_to_text.py#L42-L78","documentation":"Raised by OpenAIAudioToText.__init__ after settings creation succeeds but audio_to_text_model_id is empty or None. This field comes from the ai_model_id constructor argument or the OPENAI_AUDIO_TO_TEXT_MODEL_ID environment variable. The transcription service requires a model identifier (typically 'whisper-1') to know which model to invoke.","triggerScenarios":"Constructing OpenAIAudioToText without ai_model_id= and without OPENAI_AUDIO_TO_TEXT_MODEL_ID set in the environment or .env file. The api_key resolved (or async_client was passed), but no model identifier was provided.","commonSituations":"Using OPENAI_MODEL_ID (generic) instead of OPENAI_AUDIO_TO_TEXT_MODEL_ID (specific); .env file present but the audio_to_text model line missing; running in a fresh environment without the model env var; assuming the constructor has a default model (it does not).","solutions":["Pass ai_model_id= explicitly: OpenAIAudioToText(ai_model_id='whisper-1', ...).","Set OPENAI_AUDIO_TO_TEXT_MODEL_ID=whisper-1 in your environment or .env file.","Verify the model name is correct per https://platform.openai.com/docs/models."],"exampleFix":"# before\nservice = OpenAIAudioToText(\n    api_key='sk-...',\n)\n# after\nservice = OpenAIAudioToText(\n    ai_model_id='whisper-1',\n    api_key='sk-...',\n)","handlingStrategy":"validation","validationCode":"import os\n\nmodel_id = os.environ.get('OPENAI_AUDIO_TO_TEXT_MODEL_ID')\nif not model_id:\n    raise ValueError(\n        'OPENAI_AUDIO_TO_TEXT_MODEL_ID is not set (e.g. \"whisper-1\"). '\n        'Set it in your environment or .env file, or pass ai_model_id= to the constructor.'\n    )","typeGuard":null,"tryCatchPattern":"from semantic_kernel.exceptions.service_exceptions import ServiceInitializationError\n\ntry:\n    service = OpenAIAudioToText(\n        ai_model_id=os.environ.get('OPENAI_AUDIO_TO_TEXT_MODEL_ID'),\n        api_key=os.environ.get('OPENAI_API_KEY'),\n    )\nexcept ServiceInitializationError as e:\n    if 'audio to text model ID is required' in str(e):\n        print('Set OPENAI_AUDIO_TO_TEXT_MODEL_ID or pass ai_model_id=')\n    raise","preventionTips":["Set OPENAI_AUDIO_TO_TEXT_MODEL_ID (e.g. whisper-1) in your environment or .env file.","Always pass ai_model_id= explicitly in the constructor.","Use the audio-to-text-specific env var, not a generic model ID.","Check https://platform.openai.com/docs/models for valid model names."],"tags":["openai","audio-to-text","model-id","env-vars"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}