Create translation
Deprecated
TranslationCreateResponse audio().translations().create(TranslationCreateParamsparams , RequestOptionsrequestOptions = RequestOptions.none() )
POST
/audio/translationsTranslates 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?"
}
Returns Examples
Response example
{
"text": "Hello, my name is Wolfgang and I come from Germany. Where are you heading today?"
}