# OpenAI Realtime API — card for AI agents

Speech-to-speech models for real-time voice agents, priced per 1M audio and text tokens.

Maker: OpenAI · category: Voice (speech-to-text, text-to-speech)

## Price (official page)
- Free tier: none listed
- Usage price: gpt-realtime-2.1: audio $32 in / $64 out per 1M tokens; gpt-realtime-2.1-mini: audio $10 / $20
- Pricing page: https://developers.openai.com/api/docs/pricing (checked 2026-10-09)

## Connect
- npm: `npm install openai`
- PyPI: `pip install openai`
- Repository: https://github.com/openai/openai-node

## For AI agents on OpenAI's own site (AgentGid check 2026-11-13: 3 of 6)
- llms.txt: https://developers.openai.com/llms.txt (full text: https://developers.openai.com/llms-full.txt)
- Docs pages as Markdown: 78% of the pages llms.txt lists
- OpenAPI description: none found at the usual places
- Official MCP server: no · official SDK: yes · status page: no
- robots.txt lets AI assistants (ChatGPT-User, Claude-User) read the site: yes

## A year of price history (Internet Archive copies of the pricing page, read by rules)
- Months read: 1 (2026-02 to 2026-02) of https://developers.openai.com/api/docs/pricing
- A figure is any "$X/month" on the page (plans, seats and add-ons alike); open the archived copy to see which plan it is.

## Price history in AgentGid's catalog (since 2026-10-22)
- Changes recorded: 0 (a vendor price change or an editor's correction; the evidence archive keeps the pricing page of each date)

## Other APIs in this category
- LiveKit: https://agentgid.com/apis/livekit/agent.md
- ElevenLabs: https://agentgid.com/apis/elevenlabs/agent.md
- Deepgram: https://agentgid.com/apis/deepgram/agent.md
- Daily: https://agentgid.com/apis/daily/agent.md
- Retell AI: https://agentgid.com/apis/retell-ai/agent.md

## Links
- AgentGid page: https://agentgid.com/apis/openai-realtime/


## OpenAI Realtime API: live voice conversations with AI

The Realtime API is OpenAI's paid online service for spoken conversations with an AI voice. A browser, a phone call or your server streams the person's voice, and the model answers out loud in the same live connection. People can interrupt it, and it can call your own functions; for brand-new voice apps OpenAI's docs now point first to a related product, GPT-Live.

### Where to use it
- Talking assistant on your website: A visitor clicks a microphone button and talks to a helper that answers out loud and can be interrupted mid-sentence.
- A voice that answers your phone line: Connect a phone number so callers talk to the assistant, for bookings, opening hours or order status.
- Book or order by voice: While talking, the assistant checks free slots or looks up an order in your system and confirms the result out loud.
- Live captions for talks and calls: Show text of what someone says while they are still speaking, without an assistant answering back.
- Let visitors talk without exposing your key: Your server hands each visitor a key that works for a few minutes only, so the browser can connect directly and your main key stays private.
- Speaking practice partner: A language-learning app where the learner holds a spoken conversation and the tutor corrects pronunciation and grammar as they go. (idea, not from the official pages)

### How to start
- Create an OpenAI API key and keep it on your server in OPENAI_API_KEY; it is only used to make short-lived client keys.

```
export OPENAI_API_KEY="your_api_key_here"
```

- Install the Agents SDK in your web app (it uses WebRTC in the browser automatically).

```
npm install @openai/agents zod
```

- Add a server route that creates the client secret, then connect from the page with RealtimeSession and that key.

```
curl -X POST https://api.openai.com/v1/realtime/client_secrets \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"session": {"type": "realtime", "model": "gpt-realtime"}}'
```


### License
It is a paid online service, not open source. You own what is said in the session and what the model answers. You must follow OpenAI's terms and usage policies, and OpenAI's voice agent library is free under the MIT license.

### Good to know
- The main key must stay on your server; browsers and phone apps get short-lived client keys from your server instead.
- You pay per token of audio and text; the whole conversation is sent again for every answer, so later turns cost more.
- For a new talking app, OpenAI now suggests starting with GPT-Live, billed per second of conversation.
- Phone calls need a phone number from a separate calling provider such as Twilio, connected to OpenAI.

Checked 2026-11-10 against: https://developers.openai.com/api/docs/guides/realtime.md, https://developers.openai.com/api/docs/guides/audio.md, https://developers.openai.com/api/docs/guides/live.md, https://developers.openai.com/api/docs/guides/live-migration.md, https://developers.openai.com/api/docs/guides/voice-agents.md, https://developers.openai.com/api/docs/guides/voice-webrtc.md, https://developers.openai.com/api/docs/guides/voice-websockets.md, https://developers.openai.com/api/docs/guides/voice-sip.md, https://developers.openai.com/api/docs/guides/voice-server-controls.md, https://developers.openai.com/api/docs/guides/voice-latency-cost.md, https://developers.openai.com/api/docs/guides/realtime-conversations.md, https://developers.openai.com/api/docs/guides/realtime-transcription.md, https://developers.openai.com/api/docs/guides/realtime-mcp.md, https://developers.openai.com/api/reference/resources/realtime/subresources/client_secrets/methods/create.md, https://developers.openai.com/api/reference/resources/realtime/subresources/calls/methods/create.md, https://developers.openai.com/api/docs/pricing.md, https://developers.openai.com/api/docs/guides/error-codes.md, https://developers.openai.com/api/docs/guides/rate-limits.md, https://developers.openai.com/api/docs/guides/your-data.md, https://developers.openai.com/api/docs/guides/embeddings.md, https://developers.openai.com/learn/docs-mcp.md, https://github.com/openai/openai-node/blob/master/README.md, https://registry.npmjs.org/@openai/agents/0.21.0, https://registry.npmjs.org/@openai/agents-realtime/0.21.0, https://registry.npmjs.org/openai/7.54.0, https://pypi.org/pypi/openai/3.48.0/json

### Mistakes to avoid
- Don't: session.connect({ apiKey: process.env.OPENAI_API_KEY }) in browser code → Do: Create a client secret on your server and pass its ek_ value to session.connect in the browser (A standard key in the browser can be copied by anyone; the Agents SDK also refuses a non-ek_ key in a browser by default.)
- Don't: Sending the OpenAI-Beta realtime=v1 header and listening for old beta event names → Do: Drop the beta header, create keys with POST /v1/realtime/client_secrets, and use GA event names such as response.output_audio.delta (Beta-era code from older tutorials does not match the GA interface.)
- Don't: Changing instructions or the tool list after every turn → Do: Keep instructions and tools fixed for the session so earlier turns stay cached (Changes at the start of the conversation cut the cache rate and raise the cost of later turns.)
- Don't: On a WebSocket connection, letting queued audio keep playing when the user starts talking → Do: On input_audio_buffer.speech_started stop playback and send conversation.item.truncate with the milliseconds actually heard (Over WebSocket your app plays the audio, so the model only knows where it was cut off if you tell it.)

### Questions
- What does one minute of talking cost? Rough math from the docs: a minute of the person speaking is 600 audio tokens and a minute of the assistant speaking is 1,200; at gpt-realtime-2.1 list prices ($32 and $64 per 1M) that is about $0.02 and $0.08, plus instructions, text and the re-sent conversation.
- Should I use WebRTC or WebSocket? WebRTC from browsers and phones, WebSocket from your own server; the SDK picks WebRTC automatically in a browser.
- Can it answer real phone calls? Yes, through a phone provider that supports SIP, such as Twilio; OpenAI sends your server a webhook for each incoming call.
- Is it the right choice for a new voice app? The docs now suggest GPT-Live first for new conversational apps and keep the Realtime API for its session and tool model.
- Does OpenAI train on the conversations? No, not by default; Realtime sessions are kept in safety logs up to 30 days and not stored otherwise.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
