> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.deepgram.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.deepgram.com/_mcp/server.

# Configure Deepgram on Modal

## Configure Deepgram

Modal Deepgram deployments are managed by labels. Each label specifies a set of Deepgram TOML files and models. Keep in mind that Deepgram models, such as Flux and Aura-2, must be deployed on independent Modal stacks, and cannot be co-hosted with any other models.

Set the label by exporting an environment variable.

```bash
export DEPLOY_LABEL=stt
```

These resources are stored on Modal Volumes when you run

```bash
modal run -m modal_deepgram.deepgram_resources \
  --label $DEPLOY_LABEL \
  --model-links-path <path-to-models-list-txt-file> \
  --deploy-type license-proxy \
  --source-api-config-file <api-toml-file> \
  --source-engine-config-file <engine-toml-file>
```

This will

* Download the Deepgram model weights to a Modal Volume
* Pull the appropriate config files from Deepgram's repo
* Patch the config files
  * Use `localhost` with the desired ports
  * Specify the Modal Volume mount point for model weights

When calling `modal run -m modal_deepgram.deepgram_resources`, note that

* the models `.txt` filepath should be local
* the config file names should match one of those found in the [Deepgram self-hosted resources repo](https://github.com/deepgram/self-hosted-resources/tree/main/common)
* the `--deploy-type` argument takes either `license-proxy` or `standard` and will choose the appropriate directory to pull the configs (default is `license-proxy`)

### Edit a Deepgram TOML config

Update config files for a deployment after the initial `modal_deepgram.deepgram_resources` run by pulling them from the Volume, editing, and uploading back to the Volume.

1. Pull the file locally:

   ```bash
   modal volume get deepgram-cache configs/{label}/api.toml ./api.toml
   ```

2. Edit `./api.toml` in your editor.

3. Push the change back:

   ```bash
   modal volume put deepgram-cache ./api.toml configs/{label}/api.toml
   ```

4. Redeploy with `DEPLOY_LABEL={label} modal deploy -m modal_deepgram.app` to apply.

### Update models

Passing `--model-links-path` when you run `modal_deepgram.deepgram_resources` wipes `/models/{label}/` and downloads every URL in the file.

```bash
modal run -m modal_deepgram.deepgram_resources \
  --label stt \
  --model-links-path ./model-links.txt
```

## Example

The [quickstart](/docs/deploy-deepgram-on-modal) shows you how to deploy a STT service. If you wanted to deploy Aura-2 TTS instead, you would follow these steps:

1. Save your Aura-2 model links to `./tts-model-links.txt`.

2. Run `prepare_resources` with the `tts` label and Aura-2 config files. For language-specific deployments, swap the polyglot configs for variants like `api.aura-2-en.toml` / `engine.aura-2-en.toml`.

   ```bash
   export DEPLOY_LABEL=tts

   modal run -m modal_deepgram.deepgram_resources \
     --label $DEPLOY_LABEL \
     --model-links-path ./tts-model-links.txt \
     --source-api-config-file api.aura-2-polyglot.toml \
     --source-engine-config-file engine.aura-2-polyglot.toml
   ```

3. Update the hardware literals in `modal_deepgram/app.py` to TTS-recommended values — see [Compute and Autoscaling → Configure hardware](/docs/modal-compute-and-autoscaling#configure-hardware).

4. Deploy:

   ```bash
   DEPLOY_LABEL=tts modal deploy -m modal_deepgram.app
   ```

## Set Deepgram release version

To change the Deepgram release, edit `DEEPGRAM_IMAGE_TAG` in `modal_deepgram/deepgram.py` and redeploy the app. This will rebuild the container image.