whisper-1 API

Chuyển giọng nói thành văn bản bằng OpenAI Whisper. Tính phí theo thời lượng âm thanh: 1 phút tương đương 1000 tokens. Trả kết quả phiên âm đồng bộ qua POST /v1/audio/transcriptions.

Dùng thử trực tuyến · Lấy API key · Đọc tài liệu

Khả năng

Mô hình
Âm thanh
Mô hình API
whisper-1
Điểm cuối
POST /v1/audio/transcriptions
Tham số
model, file

Giá hiện tại

Giá thay đổi theo tham số yêu cầu.

Ví dụ trong thư viện

Chưa có ví dụ được xuất bản cho mô hình này.

Khám phá thư viện prompt

Bắt đầu nhanh

cURL

curl --fail-with-body https://www.zzai.app/v1/audio/transcriptions \
  -H "Authorization: Bearer $SEEDANCE_API_KEY" \
  -F "model=whisper-1" \
  -F "[email protected]"

Python

import os
import requests

with open("audio.mp3", "rb") as audio:
    response = requests.post(
        "https://www.zzai.app/v1/audio/transcriptions",
        headers={"Authorization": "Bearer " + os.environ["SEEDANCE_API_KEY"]},
        data={"model": "whisper-1"},
        files={"file": ("audio.mp3", audio, "audio/mpeg")},
        timeout=120,
    )
response.raise_for_status()
print(response.json()["text"])

JavaScript

import { readFile } from 'node:fs/promises';

const form = new FormData();
form.set('model', 'whisper-1');
form.set('file', new Blob([await readFile('audio.mp3')], { type: 'audio/mpeg' }), 'audio.mp3');
const response = await fetch('https://www.zzai.app/v1/audio/transcriptions', {
  method: 'POST',
  headers: { Authorization: 'Bearer ' + process.env.SEEDANCE_API_KEY },
  body: form,
});
if (!response.ok) throw new Error(await response.text());
console.log((await response.json()).text);

Câu hỏi thường gặp

Gọi mô hình này như thế nào?

Tạo API key, dùng tên mô hình bên dưới và gửi yêu cầu tới endpoint tương thích OpenAI trong tài liệu.