Realtime API
Use OpenAI’s Realtime API with logs, cost tracking, and more!
This feature is available on all Portkey plans.
OpenAI’s Realtime API while the fastest way to use multi-modal generation, presents its own set of problems around logging, cost tracking and guardrails.
Portkey’s AI Gateway provides a solution to these problems with a seamless integration. Portkeys logging is unique in that it captures the entire request and response, including the model’s response, cost, and guardrail violations.
Here’s how to get started:
Replace your endpoint URL from OpenAI with Portkey’s endpoint URL
If you are using gpt-4o-realtime-preview-2024-10-01
, then your URL would be wss://api.portkey.ai/v1/realtime?model=gpt-4o-realtime-preview-2024-10-01
Add the following headers to your request
X-Portkey-Provider
: openaiX-Portkey-Api-Key
: PORTKEY_API_KEYX-Portkey-Virtual-Key
: PORTKEY_VIRTUAL_KEY (refer: https://portkey.ai/docs/product/ai-gateway/virtual-keys#virtual-keys)
For advanced use cases, you can use configs (https://portkey.ai/docs/product/ai-gateway/configs#configs)
If you would not like to store your API Keys with Portkey, you can pass your openai key in the Authorization
header.
Fire Away!
You can see your logs in realtime with neatly visualized traces and cost tracking.
Realtime API Traces
Next Steps
Was this page helpful?