forked from phoenix/litellm-mirror
docs(realtime.md): add new /v1/realtime endpoint
This commit is contained in:
parent
09f0c09ba4
commit
793593e735
2 changed files with 87 additions and 0 deletions
86
docs/my-website/docs/realtime.md
Normal file
86
docs/my-website/docs/realtime.md
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
import Tabs from '@theme/Tabs';
|
||||||
|
import TabItem from '@theme/TabItem';
|
||||||
|
|
||||||
|
# Realtime Endpoints
|
||||||
|
|
||||||
|
Use this to loadbalance across Azure + OpenAI.
|
||||||
|
|
||||||
|
## Proxy Usage
|
||||||
|
|
||||||
|
### Add model to config
|
||||||
|
|
||||||
|
|
||||||
|
<Tabs>
|
||||||
|
<TabItem value="openai" label="OpenAI">
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
model_list:
|
||||||
|
- model_name: openai-gpt-4o-realtime-audio
|
||||||
|
litellm_params:
|
||||||
|
model: openai/gpt-4o-realtime-preview-2024-10-01
|
||||||
|
api_key: os.environ/OPENAI_API_KEY
|
||||||
|
```
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="openai+azure" label="OpenAI + Azure">
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
model_list:
|
||||||
|
- model_name: gpt-4o
|
||||||
|
litellm_params:
|
||||||
|
model: azure/gpt-4o-realtime-preview
|
||||||
|
api_key: os.environ/AZURE_SWEDEN_API_KEY
|
||||||
|
api_base: os.environ/AZURE_SWEDEN_API_BASE
|
||||||
|
|
||||||
|
- model_name: openai-gpt-4o-realtime-audio
|
||||||
|
litellm_params:
|
||||||
|
model: openai/gpt-4o-realtime-preview-2024-10-01
|
||||||
|
api_key: os.environ/OPENAI_API_KEY
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</Tabs>
|
||||||
|
|
||||||
|
### Start proxy
|
||||||
|
|
||||||
|
```bash
|
||||||
|
litellm --config /path/to/config.yaml
|
||||||
|
|
||||||
|
# RUNNING on http://0.0.0.0:8000
|
||||||
|
```
|
||||||
|
|
||||||
|
### Test
|
||||||
|
|
||||||
|
Run this script using node - `node test.js`
|
||||||
|
|
||||||
|
```js
|
||||||
|
// test.js
|
||||||
|
const WebSocket = require("ws");
|
||||||
|
|
||||||
|
const url = "ws://0.0.0.0:4000/v1/realtime?model=openai-gpt-4o-realtime-audio";
|
||||||
|
// const url = "wss://my-endpoint-sweden-berri992.openai.azure.com/openai/realtime?api-version=2024-10-01-preview&deployment=gpt-4o-realtime-preview";
|
||||||
|
const ws = new WebSocket(url, {
|
||||||
|
headers: {
|
||||||
|
"api-key": `f28ab7b695af4154bc53498e5bdccb07`,
|
||||||
|
"OpenAI-Beta": "realtime=v1",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
ws.on("open", function open() {
|
||||||
|
console.log("Connected to server.");
|
||||||
|
ws.send(JSON.stringify({
|
||||||
|
type: "response.create",
|
||||||
|
response: {
|
||||||
|
modalities: ["text"],
|
||||||
|
instructions: "Please assist the user.",
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
|
ws.on("message", function incoming(message) {
|
||||||
|
console.log(JSON.parse(message.toString()));
|
||||||
|
});
|
||||||
|
|
||||||
|
ws.on("error", function handleError(error) {
|
||||||
|
console.error("Error: ", error);
|
||||||
|
});
|
||||||
|
```
|
|
@ -221,6 +221,7 @@ const sidebars = {
|
||||||
"rerank",
|
"rerank",
|
||||||
"assistants",
|
"assistants",
|
||||||
"batches",
|
"batches",
|
||||||
|
"realtime",
|
||||||
"fine_tuning",
|
"fine_tuning",
|
||||||
{
|
{
|
||||||
type: "link",
|
type: "link",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue