Amazon
Synthorai 上的所有 Amazon 模型:一個端點,即時價格。
1 個模型 · realtime / audio · 輸入價低至 $0.06/M
為什麼透過 Synthorai 使用 Amazon
- 按用量計費,無需訂閱。 一組 key 用遍所有模型,無需 Amazon 帳號。
- 零提示詞留存。 閘道預設零 prompt 保留;上游則適用 Amazon 的資料政策。 詳情 →
Amazon 模型與價格
| 模型 | 輸入 /M | 輸出 /M |
|---|---|---|
| nova-2-sonic邀請制測試 | $0.06 | $0.24 |
廠商牌價,無平台加價。各模型頁面的價格即時更新。 以下為官方 list 價。已登入的使用者可在 /console/pricing 查看含工作空間折扣的實際價格。
30 秒用上 Amazon 模型
import asyncio, base64, json, websockets
URL = "wss://synthorai.io/v1/realtime?model=nova-2-sonic"
# Send ONLY the Authorization header — the beta protocol is retired.
HEADERS = {"Authorization": "Bearer sk-syn-..."}
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": {
"type": "realtime",
"output_modalities": ["audio"],
"audio": {"output": {"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=nova-2-sonic", {
// Send ONLY the Authorization header — the beta protocol is retired.
headers: { Authorization: "Bearer sk-syn-..." },
});
ws.on("open", () => {
// configure the speech-to-speech session
ws.send(JSON.stringify({ type: "session.update", session: {
type: "realtime", output_modalities: ["audio"], audio: { output: { 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-...' \
'wss://synthorai.io/v1/realtime?model=nova-2-sonic' <<'EOF'
{"type":"session.update","session":{"type":"realtime","output_modalities":["audio"],"audio":{"output":{"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-...")
// Send ONLY the Authorization header — the beta protocol is retired.
c, _, err := websocket.DefaultDialer.Dial("wss://synthorai.io/v1/realtime?model=nova-2-sonic", 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{
"type": "realtime", "output_modalities": []string{"audio"},
"audio": map[string]any{"output": map[string]any{"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-...")
// Send ONLY the Authorization header — the beta protocol is retired.
.buildAsync(URI.create("wss://synthorai.io/v1/realtime?model=nova-2-sonic"), 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\":{\"type\":\"realtime\",\"output_modalities\":[\"audio\"],\"audio\":{\"output\":{\"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);關於 Amazon
Amazon 的 Nova 系列涵蓋文字、多模態與語音對語音模型。在 Synthorai 上,語音對語音產品線可透過與所有其他供應商相同的 realtime socket 與金鑰來存取,採用即時按量計費,且不需要 Amazon 帳號。
常見問題
不用訂閱要怎麼取得 Amazon API key?
不需要 Amazon 帳號:註冊 Synthorai,建立一組 API key,本頁所有 Amazon 模型都能透過 OpenAI 相容端點呼叫,按用量計費,無需訂閱(標示「邀請制測試」的模型另需申請通過)。
Amazon API 的價格是多少?
按 token 計費的模型輸入價低至 $0.06/M;每個模型的即時單價見上表,皆為廠商牌價,無平台加價。
可以使用自己的 Amazon 金鑰(BYOK)嗎?
Amazon 目前尚未支援 BYOK;請求會依列出的費率在 Synthorai 的託管通道上執行。
Amazon 的 API 資料留存政策是什麼?
閘道預設零 prompt 保留;上游則適用 Amazon 的資料政策。
其他廠商