GPT Realtime 2.1
廠商牌價,無平台加價,按用量計費。 以下為官方 list 價。已登入的使用者可在 /console/pricing 查看含工作空間折扣的實際價格。 以 70% 快取命中率計算的等效輸入價:$1.48/M. 提示詞超過最小長度後自動進行前綴快取,無需改程式碼;快取讀取有折扣(當前模型最高 90%),且沒有寫入費。
30 秒用上 GPT Realtime 2.1
相容 OpenAI Realtime:透過 WebSocket 連線,音訊進、音訊出。WS /v1/realtime
import asyncio, base64, json, websockets
URL = "wss://synthorai.io/v1/realtime?model=gpt-realtime-2.1"
HEADERS = {"Authorization": "Bearer sk-syn-...", "OpenAI-Beta": "realtime=v1"}
async def main():
async with websockets.connect(URL, additional_headers=HEADERS) as ws:
# 1) configure the speech-to-speech session
await ws.send(json.dumps({
"type": "session.update",
"session": {"modalities": ["audio", "text"], "voice": "alloy"},
}))
# 2) send input audio (base64 PCM16), then request a spoken reply
await ws.send(json.dumps({"type": "input_audio_buffer.append", "audio": pcm16_b64}))
await ws.send(json.dumps({"type": "input_audio_buffer.commit"}))
await ws.send(json.dumps({"type": "response.create"}))
# 3) stream the model's audio (and text) back
async for raw in ws:
ev = json.loads(raw)
if ev["type"] == "response.audio.delta":
play(base64.b64decode(ev["delta"])) # audio out
elif ev["type"] == "response.done":
break
asyncio.run(main())import WebSocket from "ws";
const ws = new WebSocket("wss://synthorai.io/v1/realtime?model=gpt-realtime-2.1", {
headers: { Authorization: "Bearer sk-syn-...", "OpenAI-Beta": "realtime=v1" },
});
ws.on("open", () => {
// configure the speech-to-speech session
ws.send(JSON.stringify({ type: "session.update", session: { modalities: ["audio", "text"], voice: "alloy" } }));
// send input audio (base64 PCM16), then request a spoken reply
ws.send(JSON.stringify({ type: "input_audio_buffer.append", audio: pcm16Base64 }));
ws.send(JSON.stringify({ type: "input_audio_buffer.commit" }));
ws.send(JSON.stringify({ type: "response.create" }));
});
ws.on("message", (raw) => {
const ev = JSON.parse(raw.toString());
if (ev.type === "response.audio.delta") playAudio(Buffer.from(ev.delta, "base64")); // audio out
else if (ev.type === "response.done") ws.close();
});# Realtime is a WebSocket protocol — use a WS client such as websocat.
# Each line below is one OpenAI Realtime event (JSON) sent to the session.
websocat -H 'Authorization: Bearer sk-syn-...' -H 'OpenAI-Beta: realtime=v1' \
'wss://synthorai.io/v1/realtime?model=gpt-realtime-2.1' <<'EOF'
{"type":"session.update","session":{"modalities":["audio","text"],"voice":"alloy"}}
{"type":"input_audio_buffer.append","audio":"<base64-pcm16>"}
{"type":"input_audio_buffer.commit"}
{"type":"response.create"}
EOF
# Responses stream back as response.audio.delta (base64 audio out) … response.donepackage main
import (
"net/http"
"github.com/gorilla/websocket"
)
func main() {
h := http.Header{}
h.Set("Authorization", "Bearer sk-syn-...")
h.Set("OpenAI-Beta", "realtime=v1")
c, _, err := websocket.DefaultDialer.Dial("wss://synthorai.io/v1/realtime?model=gpt-realtime-2.1", h)
if err != nil {
panic(err)
}
defer c.Close()
// configure the speech-to-speech session, send audio, request a spoken reply
c.WriteJSON(map[string]any{"type": "session.update", "session": map[string]any{"modalities": []string{"audio", "text"}, "voice": "alloy"}})
c.WriteJSON(map[string]any{"type": "input_audio_buffer.append", "audio": pcm16B64})
c.WriteJSON(map[string]any{"type": "input_audio_buffer.commit"})
c.WriteJSON(map[string]any{"type": "response.create"})
for {
var ev struct {
Type string `json:"type"`
Delta string `json:"delta"`
}
if err := c.ReadJSON(&ev); err != nil {
return
}
if ev.Type == "response.audio.delta" {
playAudio(ev.Delta) // base64 audio out
} else if ev.Type == "response.done" {
return
}
}
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.WebSocket;
import java.util.concurrent.CompletionStage;
// JDK built-in WebSocket — no extra dependency needed.
WebSocket ws = HttpClient.newHttpClient().newWebSocketBuilder()
.header("Authorization", "Bearer sk-syn-...")
.header("OpenAI-Beta", "realtime=v1")
.buildAsync(URI.create("wss://synthorai.io/v1/realtime?model=gpt-realtime-2.1"), new WebSocket.Listener() {
public CompletionStage<?> onText(WebSocket w, CharSequence data, boolean last) {
// handle response.audio.delta (base64 audio out) / response.done here
w.request(1);
return null;
}
}).join();
// configure the session, send input audio, then request a spoken reply
ws.sendText("{\"type\":\"session.update\",\"session\":{\"modalities\":[\"audio\",\"text\"],\"voice\":\"alloy\"}}", true);
ws.sendText("{\"type\":\"input_audio_buffer.append\",\"audio\":\"<base64-pcm16>\"}", true);
ws.sendText("{\"type\":\"input_audio_buffer.commit\"}", true);
ws.sendText("{\"type\":\"response.create\"}", true);關於 GPT Realtime 2.1
GPT Realtime 2.1 是 OpenAI 即時語音對語音(speech-to-speech)家族的旗艦,官方公告稱其為升級版即時推理模型,改進了字母數字識別、靜音與噪音處理以及打斷行為。
- 它將該家族的上下文視窗擴展到 128K token、最大輸出 32K token,支援可配置推理力度、指令遵循,以及面向複雜語音代理工作流程的工具呼叫。
- 音訊與文字 token 依各自單價計費,快取輸入享折扣。
- 在 Synthorai 上,它透過 OpenAI 相容的 /v1/realtime WebSocket 端點提供,基於官方 Realtime SDK 構建的應用無需改動即可使用。
規格與限制
| 最大輸出(廠商規格) | 32,000 |
| 模態 | audio + text → audio + text |
| 特性 | realtime · speech-to-speech |
| 備註 | Updated realtime reasoning model with improved alphanumeric recognition, silence and noise handling, and interruption behavior; configurable reasoning effort and tool use for voice-agent workflows; 128k context. |
| 提示詞快取 | 自動 · 最小前綴 1,024 token · TTL 5–10m, up to 1h |
常見問題
GPT Realtime 2.1 API 可以免費試用嗎?
GPT Realtime 2.1 目前處於邀請制測試階段,需申請開通,而非開放註冊。請在 Synthorai 主控台提交申請,審核通過後即依標準的按用量計費方式收費,無需訂閱。
GPT Realtime 2.1 最擅長什麼?
面向生產語音代理的旗艦即時檔,以及改進打斷、噪音與字母數字識別和可配置推理力度,支援工具呼叫。完整能力請見 About 一節,內容取自廠商官方發布說明。
GPT Realtime 2.1 的價格是多少?
在 Synthorai 上,GPT Realtime 2.1 輸入 $4/百萬 token、輸出 $24/百萬 token,即廠商牌價,無平台加價。快取命中的輸入 token 以 $0.4/M 計費。
如何呼叫 GPT Realtime 2.1 API?
GPT Realtime 2.1 是語音對話(speech-to-speech)模型:透過 WebSocket 連線 wss://synthorai.io/v1/realtime?model=gpt-realtime-2.1,使用 OpenAI Realtime SDK(或原生 WebSocket)即可,音訊輸入、音訊輸出。它不是 POST /v1/audio/transcriptions 檔案上傳介面。以你的 sk-syn key 驗證,並鏡射 OpenAI-Beta 標頭。
如何開通 GPT Realtime 2.1?
GPT Realtime 2.1 處於邀請制測試階段:請在 Synthorai 主控台申請開通。審核通過後,用法與其他模型相同:把 OpenAI SDK 的 base_url 指向 "https://synthorai.io/v1",model 設為 "gpt-realtime-2.1" 即可。