OpenAIAudioCreationWrapper
Python template · sinapsis_openai.templates.openai_audio
Overview
Template that wraps the `OpenAI.audio.speech.create` API endpoint to perform audio creation tasks. This template excludes the `input` attribute (expected to be provided via the DataContainer packet `content`) and the `model` attribute (which is set in the template `AttributesBaseModel`) from the API caller. This ensures that the text input is dynamically extracted from the packet and that the speech model is passed exclusively via the template attributes. The PACKET_TYPE_NAME indicates that the template processes texts packets in the DataContainer
create — inherited documentation
Generates audio from the input text.
Returns the audio file content, or a stream of audio events.
Args: input: The text to generate audio for. The maximum length is 4096 characters.
model: One of the available [TTS models](https://platform.openai.com/docs/models#tts): `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`.
voice: The voice to use when generating the audio. Supported built-in voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the voices are available in the [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).
instructions: Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`.
response_format: The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`.
speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default.
stream_format: The format to stream the audio in. Supported formats are `sse` and `audio`. `sse` is not supported for `tts-1` or `tts-1-hd`.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
Capabilities
Capabilities: not setInstallation
Install the published package using pip or uv.
pip install sinapsis-openai==1.0.0uv pip install sinapsis-openai==1.0.0uv add sinapsis-openai==1.0.0Configuration
Effective fields from the inspector schema, including nested Pydantic model fields.
Specifies the speech model to be used for generating audio. output_dir (str | None): Relative path where the binary audio output file will be saved (default is "openai/openai_audio.mp4"). openai_init api_key… Read full field description
Specifies the speech model to be used for generating audio. output_dir (str | None): Relative path where the binary audio output file will be saved (default is "openai/openai_audio.mp4"). openai_init api_key typing.Union[str, typing.Callable[[], str], NoneType]: default: None admin_api_key typing.Optional[str]: default: None workload_identity typing.Any: default: None organization typing.Optional[str]: default: None project typing.Optional[str]: default: None webhook_secret typing.Optional[str]: default: None provider typing.Any: default: None base_url typing.Any: default: None websocket_base_url typing.Any: default: None timeout typing.Any: default: NOT_GIVEN max_retries <class 'int'>: default: 2 default_headers typing.Optional[typing.Mapping[str, str]]: default: None default_query typing.Optional[typing.Mapping[str, object]]: default: None http_client typing.Any: default: None _strict_response_validation <class 'bool'>: default: False _enforce_credentials <class 'bool'>: default: Truecreate voice typing.Any: default: None instructions typing.Any: default: <openai.Omit object at 0x74f9db285a90> response_format typing.Any: default: <openai.Omit object at 0x74f9db285a90> speed typing.Any: default: <openai.Omit object at 0x74f9db285a90> stream_format typing.Any: default: <openai.Omit object at 0x74f9db285a90> extra_headers typing.Any: default: None extra_query typing.Any: default: None extra_body typing.Any: default: None timeout typing.Any: default: NOT_GIVEN
Required
Default: null
Required
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Required
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: 2
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Configuration example
Example from the Python docstring:
agent:
name: my_test_agent
templates:
- template_name: InputTemplate
class_name: InputTemplate
- template_name: OpenAIAudioCreationWrapper
class_name: OpenAIAudioCreationWrapper
template_input: InputTemplate
attributes:
model: 'tts-1'
output_dir: openai/openai_audio.mp4
openai_init:
api_key: openai_api_key
max_retries: 2
create:
voice: 'alloy'Show schema-based configuration skeleton
templates:
- template_name: "OpenAIAudioCreationWrapper"
class_name: "OpenAIAudioCreationWrapper"
attributes:
model: "<required>"
create:
speed: null
voice: null
timeout: null
extra_body: null
extra_query: null
instructions: null
extra_headers: null
stream_format: null
response_format: null
openai_init:
api_key: null
project: null
timeout: null
base_url: null
provider: null
http_client: null
max_retries: 2
organization: null
admin_api_key: null
default_query: null
webhook_secret: null
default_headers: null
workload_identity: null
websocket_base_url: null
Inheritance
sinapsis_openai.templates.openai_audio.OpenAIAudioCreationEnvironment variables
Environment definitions belong to their canonical Python modules.