> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeroruntime.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Aws

> Python API reference for the aws text-to-speech plugin.

<Card title="Usage guide" icon="book" href="/plugins/tts/aws" horizontal>
  Setup, environment variables, and Python/JavaScript/Go usage examples.
</Card>

## AWSPollyTTS

AWS Polly TTS plugin.

Synthesizes speech via Amazon Polly at 24 kHz with support for neural,
standard, generative, and long-form voice engines across 60+ voices and
20+ languages.

### Constructor

```python theme={null}
AWSPollyTTS(*, aws_secret_access_key: 'Optional[str]' = None, aws_session_token: 'Optional[str]' = None, aws_access_key_id: 'Optional[str]' = None, region: 'str' = 'us-east-1', voice: 'str' = 'Joanna', engine: 'str' = 'neural', speed: 'float' = 1.0, pitch: 'float' = 0.0, **kwargs: 'Any') -> 'None'
```

<ParamField path="aws_secret_access_key" type="Optional[str]">
  AWS secret access key paired with `aws_access_key_id`. Falls back to `AWS_SECRET_ACCESS_KEY` when omitted.
</ParamField>

<ParamField path="aws_session_token" type="Optional[str]">
  Temporary session token for short-lived IAM role credentials (e.g. from `sts:AssumeRole`). Omit for long-term credentials. Falls back to `AWS_SESSION_TOKEN`.
</ParamField>

<ParamField path="aws_access_key_id" type="Optional[str]">
  AWS access key ID. Falls back to the `AWS_ACCESS_KEY_ID` environment variable when omitted.
</ParamField>

<ParamField path="region" type="str" default="us-east-1">
  AWS region hosting the Polly endpoint, e.g. `"us-east-1"`, `"eu-west-1"`, `"ap-southeast-1"`. Defaults to `"us-east-1"`.
</ParamField>

<ParamField path="voice" type="str" default="Joanna">
  Polly voice ID to use for synthesis. Defaults to `"Joanna"` (US English, female, neural). Other popular options include `"Matthew"` (US English, male), `"Amy"` (British English, female), `"Brian"` (British English, male), `"Celine"` (French, female). See the `AWS Polly voice list <https://docs.aws.amazon.com/polly/latest/dg/voicelist.html>`\_ for the full catalogue.
</ParamField>

<ParamField path="engine" type="str" default="neural">
  Polly synthesis engine. One of: \* `"neural"` (default): high-quality neural TTS; supports a subset of voices. \* `"standard"`: concatenative synthesis; broadest voice support. \* `"generative"`: generative model for expressive speech; select voices only. \* `"long-form"`: optimised for longer text passages; select voices only.
</ParamField>

<ParamField path="speed" type="float" default="1.0">
  Playback rate multiplier (`1.0` = normal). Currently stored but not applied at the Polly API level. Defaults to `1.0`.
</ParamField>

<ParamField path="pitch" type="float" default="0.0">
  Pitch adjustment in semitones. Currently stored but not applied at the Polly API level. Defaults to `0.0`.
</ParamField>

### aclose

```python theme={null}
def aclose(self) -> 'None'
```

Release any resources held by the provider.

### emit

```python theme={null}
def emit(self, event: 'T', *args: 'Any') -> 'None'
```

Emit an event, invoking all registered handlers with the given arguments.

Handlers are called in registration order. Coroutine handlers are
scheduled on the running event loop. If the emitter is closed, the call
is a no-op.

<ParamField path="event" type="T" required>
  The event to emit.
</ParamField>

### interrupt

```python theme={null}
def interrupt(self) -> 'None'
```

Interrupt and cancel the current synthesis for the active session, if any.

### off

```python theme={null}
def off(self, event: 'T', callback: 'Callable[..., Any]') -> 'None'
```

Remove a previously registered handler for an event.

If the handler is not registered for the event, the call is a no-op.

<ParamField path="event" type="T" required>
  The event the handler was registered for.
</ParamField>

<ParamField path="callback" type="Callable[..., Any]" required>
  The handler to remove.
</ParamField>

### on

```python theme={null}
def on(self, event: 'T', callback: 'Callable[..., Any] | None' = None) -> 'Callable[..., Any]'
```

Register a handler for an event.

Can be used directly by passing a callback, or as a decorator when
`callback` is omitted.

<ParamField path="event" type="T" required>
  The event to listen for.
</ParamField>

<ParamField path="callback" type="Callable[..., Any] | None">
  The handler to invoke when the event is emitted. If `None`, a decorator is returned that registers the decorated function.
</ParamField>

<ResponseField name="returns" type="Callable[..., Any]">
  The registered callback when `callback` is provided, otherwise a decorator that registers and returns the function it wraps.
</ResponseField>

### on\_first\_audio\_byte

```python theme={null}
def on_first_audio_byte(self, callback: "'Callable[[int, int], Awaitable[None] | None]'") -> 'None'
```

Register the callback invoked when the first audio byte is produced.

<ParamField path="callback" type="'Callable[[int, int], Awaitable[None] | None]'" required>
  A callable, optionally async, invoked with synthesis timing information when the first audio byte is emitted.
</ParamField>

### synthesize

```python theme={null}
def synthesize(self, text: 'Any', **kwargs: 'Any') -> 'None'
```

Synthesize the given text into speech.

Implementations should convert the text to audio. The default behavior
forwards the text to the active session for playback when one is present.

<ParamField path="text" type="Any" required>
  The text to synthesize; coerced to a string if needed.
</ParamField>
