跳转到主要内容
POST
/
v1
/
audio
/
translations
语音翻译
curl --request POST \
  --url https://openp.ai/v1/audio/translations
import requests

url = "https://openp.ai/v1/audio/translations"

response = requests.post(url)

print(response.text)
const options = {method: 'POST'};

fetch('https://openp.ai/v1/audio/translations', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://openp.ai/v1/audio/translations",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://openp.ai/v1/audio/translations"

	req, _ := http.NewRequest("POST", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://openp.ai/v1/audio/translations")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://openp.ai/v1/audio/translations")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
把任意语言的音频文件 翻译并转写为英文

请求

curl https://openp.ai/v1/audio/translations \
  -H "Authorization: Bearer $OPENPAI_API_KEY" \
  -F [email protected] \
  -F model=whisper-1 \
  -F response_format=json

参数

Transcriptions 相同,但:
  • 输出语言 固定为英文(无 language 字段)。
  • whisper-1 支持此接口。

响应

{"text": "Hello, this is a test audio."}

翻译到其他语言

若需要把音频翻译到 非英文,推荐:
  1. /v1/audio/transcriptions 先转写为原语言文字。
  2. 把文字传给 /v1/chat/completions 让 LLM 翻译为目标语言。
text_zh = client.audio.transcriptions.create(model="whisper-1", file=open("a.mp3","rb")).text

text_ja = client.chat.completions.create(
    model="gpt-5.5",
    messages=[
        {"role": "system", "content": "Translate to Japanese."},
        {"role": "user", "content": text_zh},
    ],
).choices[0].message.content

计费

同 transcriptions,按音频时长计费。