AGI One RealtimeDocs接入文档 Playground · try it在线体验 Console · get an API key控制台 · 申请钥匙

AGI One Realtime

Speech-in, speech-out conversations in real time: it listens while the user talks, knows when they have finished a thought, answers naturally with an expressive voice, and stops the moment the user interrupts. The API is compatible with the OpenAI Realtime API (GA), so the official OpenAI SDKs work by changing the address and key.

实时语音对话:用户说话时一直在听,判断出一句话说完就自然接上,带情感的声音,用户随时插嘴它马上停。接口兼容 OpenAI Realtime(正式版),用 OpenAI 官方 SDK 只换地址和钥匙就能接。

Try it free for 1 minute, no sign-up →不用注册,免费试听 1 分钟 →

Base address地址wss://realtime.agioneos.com/v1/realtime
Models型号agione-realtime-1 — standard (default): the strongest understanding and reasoning——正常版(默认):理解和推理能力最强
agione-realtime-1-fast — fast: starts answering sooner, with lighter reasoning; good for quick back-and-forth——极速版:开口更快,推理轻一些,适合快问快答
agione-realtime-1-lite — lite: quick, light replies for everyday conversation——轻量版:日常对话,回得快、轻快
Audio音频PCM16, 24 kHz, mono, both directionsPCM16、24 kHz、单声道,进出都是
Region机房US West (Los Angeles)美国西部(洛杉矶)

Get started开始

  1. Open the console and sign in with Google, Apple, GitHub or email. Signing up is free, and new accounts get a $1 sign-up gift that is added with the first top-up. Add credit and you can talk to it in the playground right away, with your own key.
  2. Create an API key (sk-agione-…). It is shown once; store it on your server, never in an app or web page.
  3. Try it right away in the playground: paste the key and talk to it in your browser.
  4. Connect with the OpenAI SDK as below, or call the endpoints directly.
  1. 打开控制台,用谷歌、苹果、GitHub 或邮箱登录。注册免费,新账户送 $1 注册礼,第一次充值时一起到账。充值后,用自己的钥匙就可以马上在在线体验里和它通话。
  2. 创建 API 钥匙(sk-agione-…)。只显示一次,存在你自己的服务器上,不要放进 App 或网页。
  3. 想先试一下,打开在线体验:填上钥匙,在浏览器里直接和它说话。
  4. 照下面用 OpenAI SDK 连,或直接调接口。

Which way to connect选哪种接入方式

Your situation你的情况Use用哪种
A server or phone system handles the audio声音在你的服务器或电话系统里Server (WebSocket)服务器接入(WebSocket)
A web page or app that only needs the conversation网页或 App,只要对话Browser / app (WebRTC)浏览器 / App(WebRTC)
A web page or app, plus tools, records or control on your server网页或 App,还要在你的服务器上执行工具、记录、管控WebRTC + server sideband (recommended)WebRTC + 服务器旁路(推荐)

Server (WebSocket)服务器接入(WebSocket)

For servers, phone systems and anything that can hold a secret. Authenticate with Authorization: Bearer sk-agione-….

适合服务器、电话系统等能保管密钥的地方。用 Authorization: Bearer sk-agione-… 认证。

Python

pip install openai

import asyncio, base64
from openai import AsyncOpenAI

client = AsyncOpenAI(api_key="sk-agione-...", websocket_base_url="wss://realtime.agioneos.com/v1")

async def main():
    async with client.realtime.connect(model="agione-realtime-1") as conn:
        await conn.session.update(session={
            "type": "realtime",
            "instructions": "You are a friendly voice assistant. Keep answers short.",
            "audio": {"output": {"voice": "ivy"}},
        })
        # send microphone audio (24 kHz PCM16) as it arrives:
        #   await conn.input_audio_buffer.append(audio=base64.b64encode(chunk).decode())
        async for event in conn:
            if event.type == "response.output_audio.delta":
                play(base64.b64decode(event.delta))          # 24 kHz PCM16
            elif event.type == "input_audio_buffer.speech_started":
                stop_playback()                              # the user interrupted
            elif event.type == "response.output_audio_transcript.delta":
                print(event.delta, end="", flush=True)

asyncio.run(main())

Node.js

npm install ws

import WebSocket from "ws";

const ws = new WebSocket("wss://realtime.agioneos.com/v1/realtime?model=agione-realtime-1",
  { headers: { Authorization: `Bearer ${process.env.AGIONE_API_KEY}` } });
ws.on("open", () => ws.send(JSON.stringify({ type: "session.update",
  session: { type: "realtime", instructions: "Be brief.", audio: { output: { voice: "ivy" } } } })));
ws.on("message", (raw) => {
  const e = JSON.parse(raw);
  if (e.type === "response.output_audio.delta") play(Buffer.from(e.delta, "base64"));   // 24 kHz PCM16
  if (e.type === "input_audio_buffer.speech_started") stopPlayback();                   // user interrupted
});
// send microphone audio: ws.send(JSON.stringify({ type: "input_audio_buffer.append", audio: base64Chunk }))

Server voice activity detection is on by default: just stream audio; you do not need to commit or create responses.

默认由服务端判断说完:一直送音频就行,不用自己提交、也不用自己发 response.create。

Browser / app (WebRTC)浏览器 / App(WebRTC)

Lowest latency, and playback, echo handling and interruptions are done for you. Your server exchanges the long-lived key for a short-lived one (ek_…, 10 minutes by default) and hands it to the browser or app.

延迟最低,播放、回声、插嘴都由我们处理。你的服务器用长期钥匙换一把短期的(ek_…,默认 10 分钟),交给浏览器或 App。

1. Your server: mint a short-lived key1. 你的服务器:换短期钥匙

curl https://realtime.agioneos.com/v1/realtime/client_secrets \
  -H "Authorization: Bearer $AGIONE_API_KEY" -H "Content-Type: application/json" \
  -d '{"session": {"type": "realtime", "instructions": "Be brief.", "audio": {"output": {"voice": "ivy"}}},
       "safety_identifier": "user-7f3a…",
       "expires_after": {"seconds": 600}}'
# → {"value": "ek_…", "expires_at": 1795…, "session": {…}}

2. Browser: connect2. 浏览器:连接

const { value } = await (await fetch("/your-server/voice-token")).json();
const pc = new RTCPeerConnection();
const audio = new Audio(); audio.autoplay = true;
pc.ontrack = (e) => (audio.srcObject = e.streams[0]);
const mic = await navigator.mediaDevices.getUserMedia({ audio: { echoCancellation: true, noiseSuppression: true } });
pc.addTrack(mic.getTracks()[0]);
const dc = pc.createDataChannel("oai-events");
dc.onmessage = (m) => console.log(JSON.parse(m.data).type);

await pc.setLocalDescription(await pc.createOffer());
const r = await fetch("https://realtime.agioneos.com/v1/realtime/calls?model=agione-realtime-1", {
  method: "POST", body: pc.localDescription.sdp,
  headers: { Authorization: `Bearer ${value}`, "Content-Type": "application/sdp" } });
await pc.setRemoteDescription({ type: "answer", sdp: await r.text() });

Networks that block UDP (optional)封了 UDP 的网络(可选)

Some office and hotel networks block the UDP traffic WebRTC uses. Fetch short-lived relay servers with the same key and pass them in; the call then goes through port 443 when it has to. An empty list means no relay is needed — connect as above.

有些公司、酒店的网络会封掉 WebRTC 用的 UDP。用同一把钥匙领一份临时中继,建连接时填进去;需要时通话会走 443 端口。返回空列表就不用中继,照上面直接连。

const ice = await (await fetch("https://realtime.agioneos.com/v1/realtime/ice_servers", {
  headers: { Authorization: `Bearer ${value}` } })).json();
const pc = new RTCPeerConnection({ iceServers: ice.ice_servers });

iOS and Android work the same way with the native WebRTC libraries.

iOS、安卓用原生 WebRTC 库,做法一样。

Server sideband (app talks directly, your server stays in control)服务器旁路(App 直连说话,你的服务器同时在线)

The best of both: the app talks to us directly over WebRTC (lowest latency, playback and interruptions handled), while your server attaches to the same call with its long-lived key. From your server you set the instructions and tools, run the tools against your own database or services, and see everything the user says and every event, without ever handling audio. Recommended for apps with business logic.

两头的好处都要:App 用 WebRTC 直接跟我们说话(延迟最低,播放、插嘴都处理好),你的服务器用长期钥匙连到同一通电话上。在你的服务器上设定说明和工具、用你自己的数据库和服务执行工具、看到用户说的每一句话和每个事件,完全不用碰声音。有业务逻辑的 App 推荐这种。

App ⇄ (WebRTC: voice + events) ⇄ AGI One Realtime ⇄ (WebSocket ?call_id=…: events, tools) ⇄ your server

1. App: connect as above, then send the call ID to your server1. App:照上面连好,把通话 ID 交给你的服务器

// after the POST /v1/realtime/calls above
const callId = r.headers.get("Location").split("/").pop();          // "rtc_…"
await fetch("/your-server/attach", { method: "POST", body: JSON.stringify({ callId }) });

2. Your server: attach to the call (official OpenAI SDK)2. 你的服务器:连到这通电话(用官方 OpenAI SDK)

import json
from openai import AsyncOpenAI

client = AsyncOpenAI(api_key="sk-agione-...", websocket_base_url="wss://realtime.agioneos.com/v1")

async def attach(call_id):
    async with client.realtime.connect(call_id=call_id) as conn:
        await conn.session.update(session={
            "type": "realtime",
            "instructions": "You are the Acme support agent.",
            "tools": [{"type": "function", "name": "get_order", "description": "Look up an order",
                       "parameters": {"type": "object", "properties": {"order_id": {"type": "string"}}}}],
        })
        async for event in conn:
            if event.type == "response.function_call_arguments.done":
                result = await run_tool(event.name, json.loads(event.arguments))   # your database, payments…
                await conn.conversation.item.create(item={"type": "function_call_output",
                    "call_id": event.call_id, "output": json.dumps(result)})
                await conn.response.create()                                    # it then speaks the result
            elif event.type == "conversation.item.input_audio_transcription.completed":
                save_transcript(event.transcript)

Without the SDK: open wss://realtime.agioneos.com/v1/realtime?call_id=rtc_… with Authorization: Bearer sk-agione-… and exchange the same JSON events.

不用 SDK 也行:用 Authorization: Bearer sk-agione-… 连 wss://realtime.agioneos.com/v1/realtime?call_id=rtc_…,收发同样的 JSON 事件。

Session options会话设置

Field字段Meaning含义
instructionsThe assistant's persona and rules. If a user asks what it is built on, it can say "built on AGI One Realtime" (never unprompted); describe it your own way here, or set agione.attribution to false to leave it out.助手的身份和规矩。用户问「基于什么」时,它可以说「基于 AGI One 实时语音模型」(不主动说);想换说法就在这里写,想完全不提就把 agione.attribution 设成 false。
audio.output.voiceA voice name from the voice table, e.g. ivy (default), mei, lucia.音色表里的名字,比如 ivy(默认)、mei、lucia。
audio.input.turn_detection{"type":"semantic_vad","eagerness":"auto|low|medium|high"} (default; decides from meaning when the user has finished), {"type":"server_vad","silence_duration_ms":…}, or null to commit manually.{"type":"semantic_vad","eagerness":"auto|low|medium|high"}(默认,按意思判断说完),{"type":"server_vad","silence_duration_ms":…},或 null 自己提交。
audio.input.transcriptionSet to any object (e.g. {"model":"agione-transcribe"}) to receive the user's words as text events. Add "language": "en" (an ISO-639-1 code such as zh, es, ja) when you know which language your users speak: short phrases are then never mistaken for another language. Leave it out to detect the language automatically.填一个对象(如 {"model":"agione-transcribe"})就会收到用户说的话的文字事件。知道用户说哪种语言时,加上 "language": "zh"(ISO-639-1 代码,如 en、es、ja),短句就不会被听成别的语言;不填则自动判断。
tools, tool_choiceFunction calling, see below.工具调用,见下。
max_output_tokensUpper bound for one answer.一次回答的上限。
agione.bargeExtension. What happens when the user talks over the assistant. "smart" (default): it keeps talking (quieter over WebRTC) until it is clear what the user said. A short acknowledgement such as "mm-hmm" or "go on" does not stop it, and over WebSocket you do not even receive speech_started for it. A real interruption is announced and the answer stops. "instant": stop the moment the user makes a sound, like OpenAI.扩展。用户在它说话时开口怎么处理。"smart"(默认):先接着说(WebRTC 下声音变小),听清再定。“嗯嗯”“你继续”这类附和不会打断它,WebSocket 下连 speech_started 都不会发;真插话才通知并停下。"instant":一出声就停,和 OpenAI 一样。
agione.attributionExtension, default true. When your instructions give the assistant its own persona, it may answer "built on AGI One Realtime" if a user asks. false = never mention it.扩展,默认 true。你给了自己的人设时,用户问起它可以说「基于 AGI One 实时语音模型」。false = 完全不提。
agione.bargeExtension. How talking over the reply is handled over WebSocket: default instant (stop as soon as the user speaks); smart = wait to tell a real interruption from a short acknowledgement first.扩展。WebSocket 下用户插话怎么处理:默认 instant(一开口就停);smart = 先分清是真打断还是一声附和再定。

Voices音色

30 hand-picked voices. Put the voice name in audio.output.voice and every reply is spoken in that voice. Every voice speaks every language: the reply follows the language the user speaks, and the voice keeps its own accent, listed below. Emotion follows the meaning of each sentence. OpenAI voice names (alloy, marin, cedar…) also work and map to a similar voice.

精选 30 个人物音色。把音色名字写进 audio.output.voice,回答就用这个人的声音说。每个音色都能说各种语言:回答的语言跟着用户,口音是这个音色自己的(下表)。语气会跟着每句话的意思走。OpenAI 的声音名(alloy、marin、cedar…)也能用,会换成相近的音色。

Voice name (use in code)音色名字(写进代码)Accent口音Gender性别Style特点Listen试听
meiTaiwanese accent台湾口音Female女bright明亮
weiTaiwanese accent台湾口音Male男natural自然
jingBeijing accent北京口音Female女sweet and lively甜美活力
atlasBeijing accent北京口音Male男steady沉稳
ivyAmerican accent美国口音Female女natural and clear (default)自然清晰(默认)
noraAmerican accent美国口音Female女warm and conversational温暖健谈
leoAmerican accent美国口音Male男natural and easygoing自然随和
jackAmerican accent美国口音Male男warm and grounded温暖沉稳
ellieBritish accent英国口音Female女fresh and casual清新随和
oliverBritish accent英国口音Male男conversational亲切健谈
luciaSpanish (Spain) accent西班牙口音Female女bright and cheerful明快
mateoSpanish (Spain) accent西班牙口音Male男confident and balanced沉稳
sofiaLatin American Spanish accent拉美口音Female女friendly and soft亲切
diegoLatin American Spanish accent拉美口音Male男gentle and clear温和清晰
claraBrazilian Portuguese accent巴西口音Female女smooth and confident顺滑
tiagoBrazilian Portuguese accent巴西口音Male男deep and warm低沉温和
camilleFrench accent法国口音Female女friendly亲切
louisParisian French accent巴黎口音Male男professional专业
lenaGerman accent德国口音Female女effortless and confident自然自信
felixGerman accent德国口音Male男easygoing随和
yukiJapanese accent日本口音Female女warm and natural温暖自然
haruJapanese accent日本口音Male男clear and inviting清晰亲切
minjiSeoul Korean accent首尔口音Female女tender and clear温柔清晰
junSeoul Korean accent首尔口音Male男warm and clear温暖清晰
priyaIndian (Hindi) accent印度口音Female女friendly and reassuring亲切可靠
arjunIndian (Hindi) accent印度口音Male男clear and warm清晰温暖
laylaArabic accent阿拉伯口音Female女soft and warm柔和
omarArabic accent阿拉伯口音Male男deep and professional低沉专业
giuliaItalian accent意大利口音Female女bright and joyful明亮愉快
lucaItalian accent意大利口音Male男expressive and warm温暖有表现力

The same table as JSON, filterable by gender, accent or language (the voice's native language):

同样的表也可以用接口取,能按 gender(性别)、accent(口音)、language(音色的母语)筛:

GET /v1/voices?gender=female&accent=american
Authorization: Bearer sk-agione-…
# → {"object": "list", "data": [{"id": "ivy", "accent": "american", "accent_label": "American accent", "gender": "female",
#      "style": "natural and clear (default)", "preview_url": "/v1/voices/ivy/preview"}, …]}

Tools (function calling)工具调用

session.tools = [{"type": "function", "name": "get_weather", "description": "Weather for a city",
                  "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}]

# you receive:  response.function_call_arguments.done  {call_id, name, arguments}
# you send:     conversation.item.create {"item": {"type": "function_call_output", "call_id": …, "output": "{…}"}}
#               response.create        ← the assistant then speaks the result

Text & image input文字和图片输入

Besides speaking, users can type and send pictures in the same conversation, for example a photo, a screenshot or a document page. Text and pictures go straight to the assistant, so typed questions are answered faster and word for word. The reply is spoken as usual (with its text); set output_modalities to ["text"] for text only. The format is the same as OpenAI Realtime.

除了说话,用户也可以在同一通对话里打字、发图片,比如照片、截图、文件页面。文字和图片直接交给助手,打字提问回答得更快,一字不差。回答照常说出来(同时有文字);只要文字就把 output_modalities 设成 ["text"]。写法同 OpenAI Realtime。

# Typed text打字
{"type": "conversation.item.create", "item": {"type": "message", "role": "user",
  "content": [{"type": "input_text", "text": "Summarize what we just said"}]}}
{"type": "response.create"}

# A picture, optionally with a question图片,可以同时带一句话
{"type": "conversation.item.create", "item": {"type": "message", "role": "user",
  "content": [{"type": "input_image", "image_url": "data:image/jpeg;base64,/9j/4AAQ…"},
              {"type": "input_text", "text": "What is in this picture?"}]}}
{"type": "response.create"}
# Python (official OpenAI SDK, only the address and key changed)
conn.conversation.item.create(item={"type": "message", "role": "user", "content": [
    {"type": "input_image", "image_url": "data:image/png;base64," + base64.b64encode(png).decode()},
    {"type": "input_text", "text": "What does this screen say?"}]})
conn.response.create()
Rule规则Detail说明
Format格式Embedded pictures only: data:image/jpeg|png|webp|gif;base64,…. Web links (https://…) are not fetched.只收内嵌图片:data:image/jpeg|png|webp|gif;base64,…。网址(https://…)不会去取。
Size大小Up to about 3 MB per picture over WebSocket or the server sideband. Over a WebRTC data channel one message is at most 256 KB: shrink first (long side 1280 px, JPEG quality 0.6 is usually 100–200 KB), or send the picture from your server through the sideband.走 WebSocket 或服务器旁路,一张最多约 3 MB。走 WebRTC 数据通道,一条消息最多 256 KB:先缩小(长边 1280 像素、JPEG 质量 0.6,一般 100–200 KB),或者从你的服务器经旁路发。
Who谁能发Only role: "user" messages can carry pictures.只有 role: "user" 的消息能带图片。
Echo回声conversation.item.added shows "(image omitted)" in place of the picture, so large data is not sent back to you.conversation.item.added 里图片换成 "(image omitted)",大数据不会回传给你。
Long conversations长对话Nothing to trim on your side. We keep the context bounded automatically: older turns are condensed, and the two newest pictures are kept in full; for earlier ones the assistant remembers what it saw and said about them, so replies do not slow down as the conversation grows.你这边不用裁剪任何东西。我们自动控制上下文长度:较早的对话会被压缩,最近 2 张图片保留原图;更早的图片,助手记得当时看到了什么、说了什么。对话越来越长,回答也不会越来越慢。
Price价格Included in the per-minute price, nothing extra.包含在每分钟价格里,不另收费。

Events事件

Same names and shapes as the OpenAI Realtime API (GA).

名字和格式同 OpenAI Realtime(正式版)。

You send你发session.update input_audio_buffer.append input_audio_buffer.commit input_audio_buffer.clear conversation.item.create conversation.item.delete conversation.item.truncate conversation.item.retrieve response.create response.cancel output_audio_buffer.clear
You receive你收session.created session.updated input_audio_buffer.speech_started input_audio_buffer.speech_stopped input_audio_buffer.committed input_audio_buffer.cleared conversation.item.added conversation.item.done conversation.item.deleted conversation.item.truncated conversation.item.retrieved conversation.item.input_audio_transcription.completed conversation.item.input_audio_transcription.failed response.created response.output_item.added response.content_part.added response.output_audio.delta response.output_audio_transcript.delta response.output_text.delta response.function_call_arguments.delta response.function_call_arguments.done …done response.done output_audio_buffer.started output_audio_buffer.stopped output_audio_buffer.cleared (WebRTC) error

Endpoints接口一览

WSS /v1/realtime?model=agione-realtime-1Realtime session over WebSocketWebSocket 实时会话
POST /v1/realtime/client_secretsMint a short-lived key换短期钥匙
POST /v1/realtime/callsWebRTC: SDP offer in, SDP answer out (201)WebRTC:送 SDP offer,回 SDP answer(201)
POST /v1/realtime/calls/{id}/hangupEnd a WebRTC call挂断 WebRTC 通话
WSS /v1/realtime?call_id=rtc_…Server sideband: attach your server to a WebRTC call服务器旁路:你的服务器连到一通 WebRTC 通话
GET /v1/voices, GET /v1/voices/{id}/previewVoice table and audio preview音色表和试听
GET /v1/usageYour balance, price and last 30 days of calls余额、价格、近 30 天通话

Errors & limits错误和限制

401 invalid_api_keyMissing, wrong or revoked key.没带钥匙、钥匙不对或已作废。
402 insufficient_quotaNo credit left. A call in progress ends when credit runs out.余额用完。通话中用完会结束这通电话。
403 user_bannedThis end user broke the usage policy repeatedly (see below).这个终端用户多次违规(见下)。
400 safety_identifier_requiredYou turned on "Require an end-user id" and this call has none.你打开了“必须带用户编号”,这通电话没带。
403 account_suspendedToo many of your end users were blocked within 24 hours; the account is paused until reviewed.24 小时内被暂停的终端用户太多,账户暂停,核查后恢复。
429 rate_limit_exceededToo many simultaneous sessions for your account (10 by default; ask us for more).你的账号同时通话数超过上限(默认 10,需要更多联系我们)。
invalid_value (error eventerror 事件)A picture is not an embedded data URL, is larger than about 3 MB, or is not in a user message; the message says which.图片不是内嵌格式、超过约 3 MB,或者不在用户消息里;错误信息会写明是哪一条。
503 server_busyCapacity reached for a moment; retry shortly.一时满载,稍后重试。

End-user safety终端用户安全

Give each of your end users a stable, hashed id, and send it with every call. We combine it with your account before anything leaves our service, so if one person breaks the usage policy, only that person is blocked. Your other users and your account keep working. Never put names, emails or phone numbers in the id.

给你的每个终端用户一个固定的、哈希过的编号,每通电话都带上。我们会把它和你的账户合在一起再往外送,万一有人违规,只封这一个人,你的其他用户和账户照常。编号里不要放姓名、邮箱、电话。

How you connect接入方式Where the id goes编号放哪里
Server (WebSocket)服务器接入(WebSocket)Header请求头 OpenAI-Safety-Identifier: user-7f3a…
Browser / app (WebRTC)浏览器 / App(WebRTC)"safety_identifier" when your server mints the short-lived key; it is locked into that key在你的服务器换短期钥匙时填,编号锁在这把钥匙里,手机改不了
Server sideband服务器旁路Nothing to add: it inherits the call's id不用另外带:沿用这通电话的编号

Pricing价格

$0.04 per minute of connected session time, billed per second. One all-in price: no per-token charges. That is the price of agione-realtime-1 and agione-realtime-1-fast; agione-realtime-1-lite is $0.03 per minute. Applicable taxes are shown at checkout. Prepaid credit; see your balance and every call in the console.

按通话时长 每分钟 0.04 美元,按秒计费;一个价格就是全部费用,不按 token 收费,这是正常版和极速版的价格,轻量版 agione-realtime-1-lite 每分钟 0.03 美元;如有税费,将在付款页显示。预充值,余额和每通电话在控制台里看。

Privacy隐私政策 · Terms服务条款