litellm - 💡(How to fix) Fix [Bug]: Can Not connect to realtime in Azure [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#23740Fetched 2026-04-08 00:49:30
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×2subscribed ×2commented ×1

Error Message

/openai/realtime?api-version=2024-10-01-preview&deployment=gpt-realtime-1.5 isn't a valid URI: scheme isn't ws or wss stack trace: Traceback (most recent call last): File "/usr/lib/python3.13/site-packages/litellm/main.py", line 7091, in ahealth_check _response = await mode_handlersmode ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/litellm/realtime_api/main.py", line 361, in _realtime_health_check async with websockets.connect( # type: ignore ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ url, ^^^^ ...<4 lines>... ssl=ssl_context, ^^^^^^^^^^^^^^^^ ): ^ File "/usr/lib/python3.13/site-packages/websockets/asyncio/client.py", line 587, in aenter return await self ^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/websockets/asyncio/client.py", line 541, in await_impl self.connection = await self.create_connection() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/websockets/asyncio/client.py", line 378, in create_connection ws_uri = pars

Code Example

/openai/realtime?api-version=2024-10-01-preview&deployment=gpt-realtime-1.5 isn't a valid URI: scheme isn't ws or wss
stack trace: Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/main.py", line 7091, in ahealth_check
    _response = await mode_handlers[mode]()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/realtime_api/main.py", line 361, in _realtime_health_check
    async with websockets.connect(  # type: ignore
               ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
        url,
        ^^^^
    ...<4 lines>...
        ssl=ssl_context,
        ^^^^^^^^^^^^^^^^
    ):
    ^
  File "/usr/lib/python3.13/site-packages/websockets/asyncio/client.py", line 587, in __aenter__
    return await self
           ^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/websockets/asyncio/client.py", line 541, in __await_impl__
    self.connection = await self.create_connection()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/websockets/asyncio/client.py", line 378, in create_connection
    ws_uri = pars
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

Cannot connect to gpt-1.5-realtime via Azure

Steps to Reproduce

Attempt to add gpt-1.5-realtime via Azure provider

Relevant log output

/openai/realtime?api-version=2024-10-01-preview&deployment=gpt-realtime-1.5 isn't a valid URI: scheme isn't ws or wss
stack trace: Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/main.py", line 7091, in ahealth_check
    _response = await mode_handlers[mode]()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/realtime_api/main.py", line 361, in _realtime_health_check
    async with websockets.connect(  # type: ignore
               ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
        url,
        ^^^^
    ...<4 lines>...
        ssl=ssl_context,
        ^^^^^^^^^^^^^^^^
    ):
    ^
  File "/usr/lib/python3.13/site-packages/websockets/asyncio/client.py", line 587, in __aenter__
    return await self
           ^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/websockets/asyncio/client.py", line 541, in __await_impl__
    self.connection = await self.create_connection()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/websockets/asyncio/client.py", line 378, in create_connection
    ws_uri = pars

What part of LiteLLM is this about?

No response

What LiteLLM version are you on ?

v1.82.0

Twitter / LinkedIn details

No response

extent analysis

Fix Plan

The issue seems to be related to an invalid URI scheme when trying to connect to the gpt-1.5-realtime via Azure. To fix this, we need to ensure the URI scheme is either ws or wss.

Step-by-Step Solution

  • Check the url variable in the _realtime_health_check function to ensure it starts with either ws or wss.
  • Update the url to use the correct scheme. For example:
url = "wss://example.com/openai/realtime?api-version=2024-10-01-preview&deployment=gpt-realtime-1.5"
  • If the url is constructed dynamically, ensure the scheme is set correctly. For example:
scheme = "wss"
url = f"{scheme}://example.com/openai/realtime?api-version=2024-10-01-preview&deployment=gpt-realtime-1.5"

Verification

To verify the fix, attempt to connect to the gpt-1.5-realtime via Azure again and check the log output for any errors. If the connection is successful, the log output should not contain any errors related to the URI scheme.

Extra Tips

  • Ensure the Azure provider is configured correctly and the gpt-1.5-realtime deployment is available.
  • Check the LiteLLM documentation for any specific requirements or restrictions on connecting to the gpt-1.5-realtime via Azure.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - 💡(How to fix) Fix [Bug]: Can Not connect to realtime in Azure [1 comments, 2 participants]