Skip to main content

openai_translation

Translates spoken audio into English, using the OpenAI API.

This processor sends an audio file object to the OpenAI API and returns an English translation of the spoken audio. By default it submits the entire message payload, unless you use the file field to customize what is sent.

# Config fields, showing default values
processor:
label: ""
openai_translation:
api_key: "" # No default (required)
file: ""
model: "" # No default (required)
prompt: ""
server_address: https://api.openai.com/v1

Examples

Translate the full message payload into English using a chosen model.

processor:
openai_translation:
server_address: https://api.openai.com/v1
api_key: "${OPENAI_API_KEY}"
model: whisper-1
file: 'root = content()'

Fields

api_key

The API key for the OpenAI API. :::warning Secret This field contains sensitive information that usually shouldn't be added to a config directly, read our secrets page for more info. :::

Type: string

file

The audio file object (not file name) to translate, in one of the following formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.

Type: string

model

The name of the OpenAI model to use.

Type: string

prompt

Optional text to guide the model's style or continue a previous audio segment. The prompt should match the audio language. This field supports interpolation functions.

Type: string

server_address

The OpenAI API endpoint that the processor sends requests to. Set this to target another OpenAI-compatible service.

Type: string
Default: "https://api.openai.com/v1"