Create translation
Deprecated
client.Audio.Translations.New(ctx, body) (*Translation, error)
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 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.AudioModel("whisper-1"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", translation)
}
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?"
}