Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation
Theme

Create translation

Deprecated
TranslationCreateResponse audio().translations().create(params, requestOptions = RequestOptions.none())
POST
/audio/translations

Translates audio into English.

This endpoint supports only whisper-1. The endpoint and model are deprecated and scheduled to shut down on February 26, 2027. Migrate to /v1/realtime/translations, which requires a separate integration. See the deprecation schedule for details.

Create 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);
    }
}
Response example
{
  "text": "Hello, my name is Wolfgang and I come from Germany. Where are you heading today?"
}
Parameters
TranslationCreateParams params
InputStream file

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.

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

Optional<String> prompt

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

Optional<ResponseFormat> responseFormat

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

Optional<Double> temperature

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.

Returns
class TranslationCreateResponse:
union
class Translation:
class TranslationVerbose:
Returns Examples
Response example
{
  "text": "Hello, my name is Wolfgang and I come from Germany. Where are you heading today?"
}