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" 即可。