= openai_speech
:type: processor
:status: experimental
:categories: ["AI"]



////
     THIS FILE IS AUTOGENERATED!

     To make changes, edit the corresponding source file under:

     https://github.com/redpanda-data/connect/tree/main/internal/impl/<provider>.

     And:

     https://github.com/redpanda-data/connect/tree/main/cmd/tools/docs_gen/templates/plugin.adoc.tmpl
////

// © 2024 Redpanda Data Inc.


component_type_dropdown::[]


Generates audio from a text description and other attributes, using OpenAI API.

Introduced in version 4.32.0.


[tabs]
======
Common::
+
--

```yml
# Common config fields, showing default values
label: ""
openai_speech:
  server_address: https://api.openai.com/v1
  api_key: "" # No default (required)
  model: tts-1 # No default (required)
  input: "" # No default (optional)
  voice: alloy # No default (required)
```

--
Advanced::
+
--

```yml
# All config fields, showing default values
label: ""
openai_speech:
  server_address: https://api.openai.com/v1
  api_key: "" # No default (required)
  model: tts-1 # No default (required)
  input: "" # No default (optional)
  voice: alloy # No default (required)
  response_format: mp3 # No default (optional)
```

--
======

This processor sends a text description and other attributes, such as a voice type and format to the OpenAI API, which generates audio. By default, the processor submits the entire payload of each message as a string, unless you use the `input` configuration field to customize it.

To learn more about turning text into spoken audio, see the https://platform.openai.com/docs/guides/text-to-speech[OpenAI API documentation^].

== Fields

=== `server_address`

The Open API endpoint that the processor sends requests to. Update the default value to use another OpenAI compatible service.


*Type*: `string`

*Default*: `"https://api.openai.com/v1"`

=== `api_key`

The API key for OpenAI API.
[CAUTION]
====
This field contains sensitive information that usually shouldn't be added to a config directly, read our xref:configuration:secrets.adoc[secrets page for more info].
====



*Type*: `string`


=== `model`

The name of the OpenAI model to use.


*Type*: `string`


```yml
# Examples

model: tts-1

model: tts-1-hd
```

=== `input`

A text description of the audio you want to generate. The `input` field accepts a maximum of 4096 characters.


*Type*: `string`


=== `voice`

The type of voice to use when generating the audio.
This field supports xref:configuration:interpolation.adoc#bloblang-queries[interpolation functions].


*Type*: `string`


```yml
# Examples

voice: alloy

voice: echo

voice: fable

voice: onyx

voice: nova

voice: shimmer
```

=== `response_format`

The format to generate audio in. Default is `mp3`.
This field supports xref:configuration:interpolation.adoc#bloblang-queries[interpolation functions].


*Type*: `string`


```yml
# Examples

response_format: mp3

response_format: opus

response_format: aac

response_format: flac

response_format: wav

response_format: pcm
```


