Skip to content

Commit b506154

Browse files
Minor edits
1 parent 01c34b5 commit b506154

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/content/docs/ai-gateway/providers/universal.mdx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ You can use the Universal Endpoint to contact every provider.
1414
https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}
1515
```
1616

17-
## Description
18-
1917
AI Gateway offers multiple endpoints for each Gateway you create - one endpoint per provider, and one Universal Endpoint. The Universal Endpoint requires some adjusting to your schema, but supports additional features. Some of these features are, for example, retrying a request if it fails the first time, or configuring a [fallback model/provider](/ai-gateway/configuration/fallbacks/).
2018

2119
You can use the Universal endpoint to contact every provider. The payload is expecting an array of message, and each message is an object with the following parameters:
@@ -25,17 +23,17 @@ You can use the Universal endpoint to contact every provider. The payload is exp
2523
- `authorization`: the content of the Authorization HTTP Header that should be used when contacting this provider. This usually starts with “Token” or “Bearer”.
2624
- `query`: the payload as the provider expects it in their official API.
2725

28-
## Example
26+
## cURL example
2927

3028
<Render file="universal-gateway-example" />
3129

3230
The above will send a request to Workers AI Inference API, if it fails it will proceed to OpenAI. You can add as many fallbacks as you need, just by adding another JSON in the array.
3331

34-
## Websockets API <Badge text="beta" variant="tip" size="small" />
32+
## WebSockets API <Badge text="beta" variant="tip" size="small" />
3533

3634
The Universal Endpoint can also be accessed via a [WebSockets API](/ai-gateway/configuration/websockets-api/) which provides a single persistent connection, enabling continuous communication. This API supports all AI providers connected to AI Gateway, including those that do not natively support WebSockets.
3735

38-
## Example request
36+
## WebSockets example
3937

4038
```javascript
4139
import WebSocket from "ws";
@@ -87,7 +85,7 @@ Since the same settings can be configured in multiple locations, AI Gateway appl
8785

8886
This hierarchy ensures consistent behavior, prioritizing the most specific configurations. Use provider-level and request-level headers for fine-tuned control, and gateway settings for general defaults.
8987

90-
## Example
88+
## Hierarchy example
9189

9290
This example demonstrates how headers set at different levels impact caching behavior:
9391

0 commit comments

Comments
 (0)