O Paraformer-Realtime-v2 é o modelo de reconhecimento de fala em tempo real de geração anterior do Alibaba Cloud, transmitindo áudio em entrada e transcrições em saída por uma conexão bidirecional.
A transcrição em streaming é cobrada pelo tempo de conexão, incluindo silêncio; feche a conexão ao terminar. O catálogo não publica a tarifa real de conexão.
Preços por comprimento de entrada
Toda a solicitação usa a tarifa da faixa de comprimento de entrada. Preços em USD por milhão de tokens.
| Tokens de entrada | Entrada | Saída | Entrada (modo raciocínio) |
|---|
Especificações e limites
Áudio
| Idiomas | 7 idiomas: chinês (mandarim, além de cantonês, wu, hokkien e 15 sotaques regionais), inglês, japonês, coreano, alemão, francês, russo |
|---|---|
| Limites de áudio |
|
| Transcrição em streaming | Sim |
| Timestamps | Sim |
Modelo
| Modalidades | áudio → texto |
|---|
Geração Paraformer voltada a streaming, com personalização de hotwords e cobertura multilíngue.
conforme fonte das especificações do modelo ↗
Use o Paraformer Realtime v2 em 30 segundos
Envie quadros de áudio PCM binário por WebSocket e receba eventos de transcrição partial/final. WS /v1/audio/transcriptions/stream
# pip install websockets
# Prepare mono 16-bit little-endian PCM at 16 kHz:
# ffmpeg -i meeting.wav -f s16le -ac 1 -ar 16000 audio.pcm
import asyncio, contextlib, json, os
import websockets
MODEL = "paraformer-realtime-v2"
URL = "wss://synthorai.io/v1/audio/transcriptions/stream?model=" + MODEL + "&format=pcm&sample_rate=16000&bits=16&channels=1"
async def receive(ws):
async for raw in ws:
event = json.loads(raw)
if event["type"] in ("partial", "final"):
print(event["type"], event.get("text", ""))
elif event["type"] == "error":
raise RuntimeError(event.get("error", "ASR failed"))
elif event["type"] == "done":
return
async def main():
async with websockets.connect(URL, additional_headers={
"Authorization": "Bearer " + os.environ["SYNTHORAI_API_KEY"],
}, open_timeout=15, close_timeout=5) as ws:
reader = asyncio.create_task(receive(ws))
try:
with open("audio.pcm", "rb") as audio:
while frame := audio.read(3200): # 100 ms, sent at real-time speed
if reader.done():
await reader
return
await ws.send(frame) # binary PCM, not JSON/base64
await asyncio.sleep(len(frame) / 32000)
# No text finish message is supported. Allow a bounded receive window,
# then close normally; a trailing final transcript is not guaranteed.
await asyncio.sleep(1)
await ws.close(code=1000)
await reader
finally:
reader.cancel()
with contextlib.suppress(asyncio.CancelledError):
await reader
asyncio.run(main())// npm install ws; prepare 16 kHz mono PCM16 in audio.pcm.
import WebSocket from "ws";
import { open } from "node:fs/promises";
import { setTimeout as delay } from "node:timers/promises";
const model = "paraformer-realtime-v2";
const ws = new WebSocket("wss://synthorai.io/v1/audio/transcriptions/stream?model=" + model + "&format=pcm&sample_rate=16000&bits=16&channels=1", {
headers: { Authorization: `Bearer ${process.env.SYNTHORAI_API_KEY}` },
handshakeTimeout: 15_000,
});
ws.on("message", raw => {
const event = JSON.parse(raw.toString());
if (event.type === "partial" || event.type === "final") console.log(event.type, event.text);
if (event.type === "error") { console.error(event.error); ws.close(1000); }
if (event.type === "done") ws.close(1000);
});
ws.on("error", error => console.error(error));
ws.on("open", async () => {
const audio = await open("audio.pcm", "r");
try {
const frame = Buffer.alloc(3200); // 100 ms of mono PCM16 at 16 kHz
while (ws.readyState === WebSocket.OPEN) {
const { bytesRead } = await audio.read(frame, 0, frame.length, null);
if (!bytesRead) break;
await new Promise<void>((resolve, reject) => ws.send(frame.subarray(0, bytesRead),
{ binary: true }, error => error ? reject(error) : resolve()));
await delay(bytesRead / 32);
}
// Text finish messages are ignored. Bounded receive window, then normal close;
// the protocol does not guarantee the trailing final transcript after close.
await delay(1000);
ws.close(1000);
} catch (error) {
console.error(error);
ws.close(1000);
} finally {
await audio.close();
}
});# cURL cannot send this binary-PCM WebSocket conversation.
# Run this shell example with Python and the websockets package instead.
python3 - <<'PY'
# pip install websockets
# Prepare mono 16-bit little-endian PCM at 16 kHz:
# ffmpeg -i meeting.wav -f s16le -ac 1 -ar 16000 audio.pcm
import asyncio, contextlib, json, os
import websockets
MODEL = "paraformer-realtime-v2"
URL = "wss://synthorai.io/v1/audio/transcriptions/stream?model=" + MODEL + "&format=pcm&sample_rate=16000&bits=16&channels=1"
async def receive(ws):
async for raw in ws:
event = json.loads(raw)
if event["type"] in ("partial", "final"):
print(event["type"], event.get("text", ""))
elif event["type"] == "error":
raise RuntimeError(event.get("error", "ASR failed"))
elif event["type"] == "done":
return
async def main():
async with websockets.connect(URL, additional_headers={
"Authorization": "Bearer " + os.environ["SYNTHORAI_API_KEY"],
}, open_timeout=15, close_timeout=5) as ws:
reader = asyncio.create_task(receive(ws))
try:
with open("audio.pcm", "rb") as audio:
while frame := audio.read(3200): # 100 ms, sent at real-time speed
if reader.done():
await reader
return
await ws.send(frame) # binary PCM, not JSON/base64
await asyncio.sleep(len(frame) / 32000)
# No text finish message is supported. Allow a bounded receive window,
# then close normally; a trailing final transcript is not guaranteed.
await asyncio.sleep(1)
await ws.close(code=1000)
await reader
finally:
reader.cancel()
with contextlib.suppress(asyncio.CancelledError):
await reader
asyncio.run(main())
PYpackage main
// go get github.com/gorilla/websocket
// Prepare 16 kHz mono PCM16 in audio.pcm before running.
import (
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"time"
"github.com/gorilla/websocket"
)
func main() {
model := "paraformer-realtime-v2"
headers := http.Header{}
headers.Set("Authorization", "Bearer " + os.Getenv("SYNTHORAI_API_KEY"))
dialer := websocket.Dialer{HandshakeTimeout: 15 * time.Second}
ws, _, err := dialer.Dial("wss://synthorai.io/v1/audio/transcriptions/stream?model=" + model + "&format=pcm&sample_rate=16000&bits=16&channels=1", headers)
if err != nil { panic(err) }
defer ws.Close()
done := make(chan struct{})
go func() {
defer close(done)
for {
_, raw, err := ws.ReadMessage()
if err != nil { return }
var event struct { Type string; Text string; Error string }
if err := json.Unmarshal(raw, &event); err != nil { return }
switch event.Type {
case "partial", "final": fmt.Println(event.Type, event.Text)
case "error": fmt.Println(event.Error); return
case "done": return
}
}
}()
audio, err := os.Open("audio.pcm")
if err != nil { panic(err) }
defer audio.Close()
frame := make([]byte, 3200)
for {
select { case <-done: return; default: }
n, err := audio.Read(frame)
if err != nil && err != io.EOF { panic(err) }
if n == 0 { break }
ws.SetWriteDeadline(time.Now().Add(10 * time.Second))
if err := ws.WriteMessage(websocket.BinaryMessage, frame[:n]); err != nil { panic(err) }
time.Sleep(time.Duration(n) * time.Second / 32000)
}
// No text finish message: bounded receive window, then close normally.
// A trailing final transcript after close is not guaranteed.
select { case <-done: return; case <-time.After(time.Second): }
ws.WriteControl(websocket.CloseMessage, websocket.FormatCloseMessage(1000, ""), time.Now().Add(time.Second))
select { case <-done: case <-time.After(2 * time.Second): }
}import java.net.URI;
import java.net.http.*;
import java.nio.ByteBuffer;
import java.nio.file.*;
import java.util.concurrent.*;
// Prepare 16 kHz mono PCM16 in audio.pcm before running.
class StreamingAsrExample {
public static void main(String[] args) throws Exception {
String model = "paraformer-realtime-v2";
var closed = new CompletableFuture<Void>();
var listener = new WebSocket.Listener() {
private final StringBuilder message = new StringBuilder();
public void onOpen(WebSocket ws) { ws.request(1); }
public CompletionStage<?> onText(WebSocket ws, CharSequence data, boolean last) {
message.append(data);
if (last) {
// Normalized JSON event types: partial, final, error, done; transcript is text.
System.out.println(message);
message.setLength(0);
}
ws.request(1);
return null;
}
public CompletionStage<?> onClose(WebSocket ws, int status, String reason) {
closed.complete(null); return null;
}
public void onError(WebSocket ws, Throwable error) { closed.completeExceptionally(error); }
};
var ws = HttpClient.newHttpClient().newWebSocketBuilder()
.connectTimeout(java.time.Duration.ofSeconds(15))
.header("Authorization", "Bearer " + System.getenv("SYNTHORAI_API_KEY"))
.buildAsync(URI.create("wss://synthorai.io/v1/audio/transcriptions/stream?model=" + model + "&format=pcm&sample_rate=16000&bits=16&channels=1"), listener).join();
try (var audio = Files.newInputStream(Path.of("audio.pcm"))) {
byte[] frame = new byte[3200];
int size;
while (!closed.isDone() && (size = audio.read(frame)) != -1) {
ws.sendBinary(ByteBuffer.wrap(java.util.Arrays.copyOf(frame, size)), true).join();
Thread.sleep(Math.max(1, size / 32));
}
// Text finish messages are ignored. Bounded receive window, then close;
// a trailing final transcript after close is not guaranteed.
Thread.sleep(1000);
ws.sendClose(1000, "").join();
closed.get(2, TimeUnit.SECONDS);
} finally { ws.abort(); }
}
}Sobre o Paraformer Realtime v2
- Ele reconhece mandarim chinês junto a um conjunto incomumente amplo de dialetos regionais (cantonês, wu, hokkien, sichuan e mais), além de inglês, japonês, coreano, alemão, francês e russo, e suporta um parâmetro language_hints para guiar a detecção.
- Essa é uma adição exclusiva da v2, assim como a aceitação de taxas de amostragem arbitrárias, onde a versão anterior exigia 16 kHz.
- A documentação da Alibaba agora recomenda o Fun-ASR ou o Qwen-ASR para novos projetos, posicionando este modelo para integrações existentes.
- O que o mantém utilizável é uma superfície de parâmetros madura: tabelas de hotwords para vocabulário de domínio, normalização inversa de texto ativada por padrão, predição de pontuação ativada por padrão com pontuação semântica opcional, um silêncio máximo de sentença configurável que encerra um enunciado, e um filtro opcional de disfluências que remove palavras de preenchimento (um controle que o modelo Fun-ASR realtime não documenta).
- Timestamps por sentença e por palavra são retornados em milissegundos, e a conexão aceita PCM, WAV, MP3, Opus, Speex, AAC e AMR.
- A diarização de locutores não é oferecida no caminho de tempo real, e não há reconhecimento de emoção.
- Trate-o como um endpoint estável para pipelines já ajustados a ele, e não como o ponto de partida para trabalho novo.
- A Synthorai continua a servi-lo pelo endpoint compatível com OpenAI.
Perguntas frequentes
A API do Paraformer Realtime v2 é gratuita para testar?
Sim. Contas novas recebem 10 chamadas de teste e até $1 em créditos gratuitos, sem precisar de cartão. É o suficiente para testar o Paraformer Realtime v2 com sua carga de trabalho real antes de adicionar um meio de pagamento.
Em que o Paraformer Realtime v2 é melhor?
Transmite áudio na entrada, transcrições na saída; cobertura incomumente ampla de dialetos regionais chineses; parâmetro language_hints guia a detecção. Veja na seção Sobre o quadro completo, tirado das notas de lançamento do próprio provedor.
Quanto custa o Paraformer Realtime v2?
A transcrição em streaming é cobrada pelo tempo de conexão, incluindo silêncio; feche a conexão ao terminar. O catálogo não publica a tarifa real de conexão.
Quais idiomas o Paraformer Realtime v2 suporta?
O Paraformer Realtime v2 suporta 7 idiomas: chinês (mandarim, além de cantonês, wu, hokkien e 15 sotaques regionais), inglês, japonês, coreano, alemão, francês, russo. Na Synthorai, você o chama via POST /v1/audio/transcriptions, no mesmo formato da API de transcrição da OpenAI.
Como obtenho acesso ao Paraformer Realtime v2?
Chame Paraformer Realtime v2 por /v1/audio/transcriptions/stream com uma chave de API Synthorai. Siga o exemplo de integração desta página.
Modelos relacionados
Comparar
As especificações e os benchmarks dos fornecedores incluem links para as fontes. O suporte do gateway descreve a implementação da Synthorai. Os exemplos arquivados são solicitações individuais e não garantem o desempenho geral do modelo. Os preços vêm da API pública ou do snapshot usado na compilação.