メイン コンテンツにスキップ

このブラウザーはサポートされなくなりました。

Microsoft Edge にアップグレードすると、最新の機能、セキュリティ更新プログラム、およびテクニカル サポートを利用できます。

Microsoft Edge をダウンロードする Internet Explorer と Microsoft Edge の詳細情報
microsoft-foundry.rest.security.o-auth2-auth

Audio

Create a translation

POST /openai/v1/audio/translations

Creates a translation from the supplied request.

要求本文

The multipart request body.

Content-Type: multipart/form-data
file OpenAI.CreateTranslationRequest 必須

The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. The request must include enough format metadata for the file to be identified. We recommend an extension-bearing filename and an appropriate content type.

model string | enum 必須

ID of the model to use. Only whisper-1 (which is powered by our open source Whisper V2 model) is currently available.

次のいずれか:
string
enum
whisper-1
prompt string

An optional text to guide the model's style or continue a previous audio segment. The prompt should be in English.

response_format enum

The format of the output, in one of these options: json, text, srt, verbose_json, or vtt.

jsontextsrtverbose_jsonvtt
temperature OpenAI.CreateTranslationRequest

The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.

応答

The request has succeeded.

本文

Content-Type: application/json
次のいずれか:
text string 必須
language string 必須

The language of the output translation (always english).

duration integer 必須

The duration of the input audio.

text string 必須

The translated text.

segments OpenAI.TranscriptionSegment[]

Segments of the translated text and their corresponding details.

Client error

本文

Content-Type: application/json
error OpenAI.Error 必須
code string | null 必須
message string 必須
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
次のいずれか:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string 必須

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Server error

本文

Content-Type: application/json
error OpenAI.Error 必須
code string | null 必須
message string 必須
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
次のいずれか:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string 必須

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

要求

curl https://api.openai.com/v1/audio/translations \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F file="@/path/to/file/german.m4a" \
  -F model="whisper-1"
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
translation = client.audio.translations.create(
    file=b"Example data",
    model="whisper-1",
)
print(translation)
import fs from "fs";
import OpenAI from "openai";

const openai = new OpenAI();

async function main() {
    const translation = await openai.audio.translations.create({
        file: fs.createReadStream("speech.mp3"),
        model: "whisper-1",
    });

    console.log(translation.text);
}
main();
using System;

using OpenAI.Audio;

string audioFilePath = "audio.mp3";

AudioClient client = new(
    model: "whisper-1",
    apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY")
);

AudioTranscription transcription = client.TranscribeAudio(audioFilePath);

Console.WriteLine($"{transcription.Text}");
import fs from 'fs';
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const translation = await client.audio.translations.create({
  file: fs.createReadStream('speech.mp3'),
  model: 'whisper-1',
});

console.log(translation);
package main

import (
    "bytes"
    "context"
    "fmt"
    "io"

    "github.com/openai/openai-go"
    "github.com/openai/openai-go/option"
)

func main() {
    client := openai.NewClient(
        option.WithAPIKey("My API Key"),
    )
    translation, err := client.Audio.Translations.New(context.TODO(), openai.AudioTranslationNewParams{
        File:  io.Reader(bytes.NewBuffer([]byte("Example data"))),
        Model: openai.AudioModelWhisper1,
    })
    if err != nil {
        panic(err.Error())
    }
    fmt.Printf("%+v
", translation)
}
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.audio.AudioModel;
import com.openai.models.audio.translations.TranslationCreateParams;
import com.openai.models.audio.translations.TranslationCreateResponse;
import java.io.ByteArrayInputStream;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        TranslationCreateParams params = TranslationCreateParams.builder()
            .file(new ByteArrayInputStream("Example data".getBytes()))
            .model(AudioModel.WHISPER_1)
            .build();
        TranslationCreateResponse translation = client.audio().translations().create(params);
    }
}
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

translation = openai.audio.translations.create(file: StringIO.new("Example data"), model: :"whisper-1")

puts(translation)

回答

{
  "text": "Hello, my name is Wolfgang and I come from Germany. Where are you heading today?"
}
ja-jp
プライバシーの選択
  • AI 免責事項
  • 以前のバージョン
  • ブログ
  • 投稿
  • プライバシー
  • コンシューマーの健康に関するプライバシー
  • 利用条件
  • 商標
  • © Microsoft 2026