# Realtime

## Create Realtime Session (WebSocket)

> Establishes a WebSocket connection for real-time audio and text conversations using OpenAI's Realtime API models.\
> \
> \*\*Connection URL:\*\*\
> \`\`\`\
> wss\://api.fastrouter.ai/v1/realtime?model=MODEL\_ID\
> \`\`\`\
> \
> \*\*Authentication:\*\* Pass your FastRouter API key via \`Authorization: Bearer\` header during the WebSocket handshake.\
> \
> \*\*Required header:\*\* \`OpenAI-Beta: realtime=v1\`\
> \
> \*\*Supported models:\*\* \`openai/gpt-4o-realtime-preview-2024-12-17\` and other OpenAI realtime models.

````json
{"openapi":"3.1.0","info":{"title":"FastRouter API Reference","version":"1.0.0"},"tags":[{"name":"Realtime","description":"WebSocket-based real-time audio and text conversations using OpenAI's Realtime API models."}],"servers":[{"url":"https://api.fastrouter.ai","description":"Production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","description":"FastRouter API Key. Get yours at https://fastrouter.ai\n\nFormat: `Authorization: Bearer YOUR_API_KEY`"}},"responses":{"BadRequestError":{"description":"Bad Request - The request is malformed. This could be due to missing parameters, invalid formats, or CORS issues.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"status":{"type":"integer"}}}}}}}},"UnauthorizedError":{"description":"Invalid Credentials - Your API key is invalid, disabled, or your OAuth session has expired. Check your credentials.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"status":{"type":"integer"}}}}}}}}}},"paths":{"/v1/realtime":{"get":{"operationId":"connectRealtime","tags":["Realtime"],"summary":"Create Realtime Session (WebSocket)","description":"Establishes a WebSocket connection for real-time audio and text conversations using OpenAI's Realtime API models.\n\n**Connection URL:**\n```\nwss://api.fastrouter.ai/v1/realtime?model=MODEL_ID\n```\n\n**Authentication:** Pass your FastRouter API key via `Authorization: Bearer` header during the WebSocket handshake.\n\n**Required header:** `OpenAI-Beta: realtime=v1`\n\n**Supported models:** `openai/gpt-4o-realtime-preview-2024-12-17` and other OpenAI realtime models.","parameters":[{"name":"model","in":"query","required":false,"schema":{"type":"string","default":"gpt-4o-realtime-preview-2024-12-17"},"description":"The realtime model to use."}],"responses":{"200":{"description":"WebSocket connection established. Communicate using OpenAI Realtime API event format."},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/UnauthorizedError"}}}}}}
````


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fastrouter.ai/api-reference/realtime.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
