Skip to content

Commit 143aeea

Browse files
minor edits
1 parent 02a7181 commit 143aeea

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

src/content/docs/ai-gateway/configuration/websockets-api/index.mdx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,25 @@ The AI Gateway WebSockets API provides a persistent connection for AI interactio
1111
1. **Non-Realtime APIs** - Supports standard WebSocket communication for AI providers, including those that do not natively support WebSockets.
1212
2. **Realtime APIs** - Designed for AI providers that offer low-latency, multimodal interactions over WebSockets.
1313

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.
22+
1423
## **Key differences**
1524

16-
| Feature | Non-Realtime APIs | Realtime APIs |
17-
| :---------------------- | :----------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------- |
18-
| **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. |
25+
| Feature | Non-Realtime APIs | Realtime APIs |
26+
| :---------------------- | :----------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------ |
27+
| **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. |
2231

2332
For details on implementation, see the next section:
2433

25-
- [Non-Realtime WebSockets API](/ai-gateway/configuration/websockets-api/non-realtime-api/)
2634
- [Realtime WebSockets API](/ai-gateway/configuration/websockets-api/realtime-api/)
35+
- [Non-Realtime WebSockets API](/ai-gateway/configuration/websockets-api/non-realtime-api/)

src/content/docs/ai-gateway/configuration/websockets-api/non-realtime-api.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pcx_content_type: configuration
33
title: Non-realtime WebSockets API
44
sidebar:
5-
order: 2
5+
order: 3
66
---
77

88
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.

src/content/docs/ai-gateway/configuration/websockets-api/realtime-api.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pcx_content_type: configuration
33
title: Realtime WebSockets API
44
sidebar:
5-
order: 3
5+
order: 2
66
---
77

88
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

Comments
 (0)