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

# Aicoustics

> Use the ai-coustics acoustic denoiser in a Zero Runtime pipeline. Setup and usage in Python, JavaScript, and Go.

ai-coustics is an acoustic **noise cancellation** denoiser. Like [Sanas](/plugins/denoise/sanas),
it runs server-side over the Zero Runtime **inference gateway** (so it needs a gateway auth
token), unlike the local [RNNoise](/plugins/denoise/rnnoise) plugin. It occupies the
pipeline's `denoise` slot, cleaning the caller's audio before the rest of the pipeline runs.

## Setup

The denoiser connects to the inference gateway using your Zero Runtime auth token:

```bash theme={null}
export ZRT_AUTH_TOKEN=<token>
```

The token can also be passed explicitly to the factory.

## Usage

Build the denoiser with `AICousticsDenoise` and pass it to the pipeline's
`denoise` slot.

<CodeGroup>
  ```python Python theme={null}
  from zrt.inference import AICousticsDenoise

  denoise = AICousticsDenoise(model_id="sparrow-xxs-48khz")

  # Pipeline(denoise=denoise, ...)
  ```
</CodeGroup>

## Models

ai-coustics offers two model families:

| Family  | Use case                          | Sample rate | Examples                                                                           |
| ------- | --------------------------------- | ----------- | ---------------------------------------------------------------------------------- |
| Sparrow | Human-to-human audio              | 48 kHz      | `sparrow-xxs-48khz` (fastest), `sparrow-s-48khz`, `sparrow-l-48khz` (best quality) |
| Quail   | Human-to-machine (voice AI / STT) | 16 kHz      | `quail-vf-l-16khz`, `quail-l-16khz`, `quail-s-16khz`                               |

Match `sample_rate` to the model family (48000 for Sparrow, 16000 for Quail).

## Parameters

*Parameters for `AICousticsDenoise`. The JavaScript and Go SDKs expose the same settings in their idiomatic form.*

| Parameter     | Type  | Default          | Description                                           |
| ------------- | ----- | ---------------- | ----------------------------------------------------- |
| `model_id`    | `str` | `"rook-l-48khz"` | ai-coustics model.                                    |
| `sample_rate` | `int` | `48000`          | Audio sample rate (Hz). Use `16000` for Quail models. |
| `base_url`    | `str` | `None`           | Override the inference gateway URL.                   |

<Note>
  The JavaScript and Go factories also accept a `chunkMs` / `chunkMS` audio chunk size
  (default `10`) and a `gatewayToken` to override `ZRT_AUTH_TOKEN`.
</Note>

## Import paths

| SDK        | Import                                        | Constructor                             |
| ---------- | --------------------------------------------- | --------------------------------------- |
| Python     | `from zrt.inference import AICousticsDenoise` | `AICousticsDenoise(...)`                |
| JavaScript | `from '@zrt/js-sdk'`                          | `inference.Denoise.aicoustics({ ... })` |
| Go         | `.../zrt-golang-sdk/zrt`                      | `zrt.DenoiseAicoustics(...)`            |

Noise cancellation runs first, so [voice activity detection](/plugins/vad/silero) and
[speech-to-text](/plugins/stt/deepgram) see cleaner audio.
