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
Copy file name to clipboardExpand all lines: src/content/docs/ai-gateway/configuration/websockets-api/index.mdx
+16-7Lines changed: 16 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,16 +11,25 @@ The AI Gateway WebSockets API provides a persistent connection for AI interactio
11
11
1.**Non-Realtime APIs** - Supports standard WebSocket communication for AI providers, including those that do not natively support WebSockets.
12
12
2.**Realtime APIs** - Designed for AI providers that offer low-latency, multimodal interactions over WebSockets.
13
13
14
+
## When to use WebSockets?
15
+
16
+
WebSockets are long-lived TCP connections that enable bi-directional, real-time and non realtime communication between client and server. Unlike HTTP connections, which require repeated handshakes for each request, WebSockets maintain the connection, supporting continuous data exchange with reduced overhead. WebSockets are ideal for applications needing low-latency, real-time data, such as voice assistants.
17
+
18
+
## Key benefits
19
+
20
+
-**Reduced Overhead**: Avoid overhead of repeated handshakes and TLS negotiations by maintaining a single, persistent connection.
21
+
-**Provider Compatibility**: Works with all AI providers in AI Gateway. Even if your chosen provider does not support WebSockets, we handle it for you, managing the requests to your preferred AI provider.
|**Purpose**| Supports WebSocket-based AI interactions with providers that do not natively support WebSockets. | Enables real-time, multimodal AI interactions for providers that offer dedicated WebSocket endpoints. |
19
-
|**Use Case**| Text-based queries and responses, such as LLM requests. | Streaming responses for voice, video, and live interactions. |
20
-
|**AI Provider Support**| All AI providers in AI Gateway. |Limited to providers offering real-time WebSocket APIs.|
21
-
|**Streaming Support**| AI Gateway handles streaming via WebSockets. | Providers natively support real-time data streaming. |
|**Purpose**| Supports WebSocket-based AI interactions with providers that do not natively support WebSockets. | Enables real-time, multimodal AI interactions for providers that offer dedicated WebSocket endpoints. |
28
+
|**Use Case**| Text-based queries and responses, such as LLM requests. | Streaming responses for voice, video, and live interactions. |
29
+
|**AI Provider Support**|[All AI providers in AI Gateway.](/ai-gateway/providers)|[Limited to providers offering real-time WebSocket APIs.](/ai-gateway/configuration/websockets-api/realtime-api/#supported-providers)|
30
+
|**Streaming Support**| AI Gateway handles streaming via WebSockets. | Providers natively support real-time data streaming. |
22
31
23
32
For details on implementation, see the next section:
Copy file name to clipboardExpand all lines: src/content/docs/ai-gateway/configuration/websockets-api/non-realtime-api.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
pcx_content_type: configuration
3
3
title: Non-realtime WebSockets API
4
4
sidebar:
5
-
order: 2
5
+
order: 3
6
6
---
7
7
8
8
The Non-realtime WebSockets API allows you to establish persistent connections for AI requests without requiring repeated handshakes. This approach is ideal for applications that do not require real-time interactions but still benefit from reduced latency and continuous communication.
Copy file name to clipboardExpand all lines: src/content/docs/ai-gateway/configuration/websockets-api/realtime-api.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
pcx_content_type: configuration
3
3
title: Realtime WebSockets API
4
4
sidebar:
5
-
order: 3
5
+
order: 2
6
6
---
7
7
8
8
Some AI providers support real-time, low-latency interactions over WebSockets. AI Gateway allows seamless integration with these APIs, supporting multimodal interactions such as text, audio, and video.
0 commit comments