You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying out Realtime Websocket for OpenAI's realtime API. I followed the exact steps provided in the sample.
But I get the folllowing error on this code realtime_client = AzureRealtimeWebsocket(settings=settings) -
rahul@Mac sk-openai-realtime % uv run main.py
checking audio devices
Instructions: Start speaking. The model will detect when you stop and automatically start responding. Press ctrl + c to stop the program.
creating realtime client
creating with these configurations:
REDACTED
2024-10-01-preview
gpt-4o-realtime-preview-2
https://ai-REDACTED.openai.azure.com/openai/realtime?api-version=2024-10-01-preview&deployment=gpt-4o-realtime-preview
https://ai-REDACTED.openai.azure.com/openai/realtime?api-version=2024-10-01-preview&deployment=gpt-4o-realtime-preview-2
WARNING:azure.identity._credentials.chained:DefaultAzureCredential failed to retrieve a token from the included credentials.
Attempted credentials:
EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured.
Visit https://aka.ms/azsdk/python/identity/environmentcredential/troubleshoot to troubleshoot this issue.
ManagedIdentityCredential: ManagedIdentityCredential authentication unavailable, no response from the IMDS endpoint.
SharedTokenCacheCredential: SharedTokenCacheCredential authentication unavailable. No accounts were found in the cache.
AzureCliCredential: Azure CLI not found on path
AzurePowerShellCredential: PowerShell is not installed
AzureDeveloperCliCredential: Azure Developer CLI could not be found. Please visit https://aka.ms/azure-dev for installation instructions and then,once installed, authenticate to your Azure account using 'azd auth login'.
To mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azsdk/python/identity/defaultazurecredential/t
To mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azsdk/python/identity/defaultazurecredential/troubleshoot.
ERROR:semantic_kernel.utils.authentication.entra_id_authentication:Failed to retrieve Azure token for the specified endpoint: `https://REDACTED`.
ERROR:semantic_kernel.utils.authentication.entra_id_authentication:Failed to retrieve Azure token for the specified endpoint: `https://cognitiveservices.azure.com/.default`.
Traceback (most recent call last):
File "/Users/rahul/Developer/Cursor Projects/sk-openai-realtime/main.py", line 109, in <module>
asyncio.run(main())
File "/Users/rahul/.local/share/uv/python/cpython-3.11.11-macos-aarch64-none/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/Users/rahul/.local/share/uv/python/cpython-3.11.11-macos-aarch64-none/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rahul/.local/share/uv/python/cpython-3.11.11-macos-aarch64-none/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
File "/Users/rahul/.local/share/uv/python/cpython-3.11.11-macos-aarch64-none/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/rahul/Developer/Cursor Projects/sk-openai-realtime/main.py", line 73, in main
realtime_client = AzureRealtimeWebsocket(settings=settings,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rahul/Developer/Cursor Projects/sk-openai-realtime/.venv/lib/python3.11/site-packages/semantic_kernel/connectors/ai/open_ai/s
File "/Users/rahul/Developer/Cursor Projects/sk-openai-realtime/.venv/lib/python3.11/site-packages/semantic_kernel/connectors/ai/open_ai/services/azure_realtime.py", line 105, in __init__
super().__init__(
File "/Users/rahul/Developer/Cursor Projects/sk-openai-realtime/.venv/lib/python3.11/site-packages/pydantic/_internal/_validate_call.py",
File "/Users/rahul/Developer/Cursor Projects/sk-openai-realtime/.venv/lib/python3.11/site-packages/pydantic/_internal/_validate_call.py", line 38, in wrapper_function
return wrapper(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
My environment file .env contains all the configurations. However, to confirm I explicitely provided those values as parameters like below -
print(f"""creating with these configurations:
{os.getenv("AZURE_OPENAI_API_KEY")}
{os.getenv("AZURE_OPENAI_API_VERSION")}
{os.getenv("AZURE_OPENAI_DEPLOYMENT_NAME")}
{os.getenv("AZURE_OPENAI_ENDPOINT")}""")
realtime_client = AzureRealtimeWebsocket(settings=settings,
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
api_version=os.getenv("AZURE_OPENAI_API_VERSION"),
deployment_name=os.getenv("AZURE_OPENAI_DEPLOYMENT_NAME"),
endpoint=os.getenv("AZURE_OPENAI_ENDPOINT"))
But I still get the same error. Is this a bug in the package?
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
Bug: AzureRealtimeWebsocket can not read api_key
Python: Bug: AzureRealtimeWebsocket can not read api_key
Mar 23, 2025
I am trying out Realtime Websocket for OpenAI's realtime API. I followed the exact steps provided in the sample.
But I get the folllowing error on this code
realtime_client = AzureRealtimeWebsocket(settings=settings)
-My environment file
.env
contains all the configurations. However, to confirm I explicitely provided those values as parameters like below -But I still get the same error. Is this a bug in the package?
The text was updated successfully, but these errors were encountered: