> ## 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.

# CometAPI

> Use the CometAPI text-to-speech plugin in a Zero Runtime pipeline. Setup and usage in Python and JavaScript.

CometAPI is a **text-to-speech** plugin. It runs CometAPI's OpenAI-compatible speech API, which is handy if you already use CometAPI and want OpenAI-style voices on the same key.

## Setup

Set your CometAPI API key in the worker environment. Generate a key from the [CometAPI site](https://www.cometapi.com/):

```bash theme={null}
export COMETAPI_API_KEY=<key>
```

## Usage

Import the plugin and pass it to the pipeline's `tts` slot.

```python Python theme={null}
from zeroruntime.plugins import CometAPITTS

tts = CometAPITTS()

# Pipeline(tts=tts, ...)
```

```typescript Node JS theme={null}
import { CometAPITTS } from '@zeroruntime/js-sdk/plugins';

const tts = CometAPITTS();

// Pipeline({ tts, ... })
```

## Parameters

*Constructor parameters for `CometAPITTS`.*

| Parameter | Type | Default | Description |
| - | - | - | - |
| `api_key` | `str` | `None` | CometAPI API key. Falls back to the `COMETAPI_API_KEY` environment variable when unset. |
| `model` | `str` | `"tts-1"` | Voice model to synthesize with, e.g. "tts-1" or "tts-1-hd". |
| `voice` | `str` | `"alloy"` | Voice name, e.g. "alloy", "echo", "nova" or "shimmer". |
| `speed` | `float` | `1.0` | Speaking rate multiplier, 0.25 to 4.0, where 1.0 is normal speed. |
| `response_format` | `str` | `"pcm"` | Audio format of the synthesized speech, e.g. "pcm". |
| `chunked_synthesis` | `bool` | `False` | Set to True to synthesize each sentence chunk as a separate request instead of one request per utterance. |

## Import paths

| SDK | Import | Constructor |
| - | - | - |
| Python | `from zeroruntime.plugins import CometAPITTS` | `CometAPITTS()` |
| Node JS | `import { CometAPITTS } from '@zeroruntime/js-sdk/plugins'` | `CometAPITTS()` |

Synthesized audio is streamed back to the caller after the [LLM](https://docs.zeroruntime.ai/runtime-sdk/plugins/overview.md) produces a response.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.