---
name: stt-tts
description: Use when selecting or troubleshooting speech recognition and synthesis for a Telnyx AI Assistant, or implementing standalone transcription or speech generation. Use voice-ai-agent for the complete assistant and phone-call setup.
version: "1.1.0"
author: Telnyx
type: skill-md
---

# Speech Recognition and Synthesis

Choose the interface that matches the task. Hosted assistant settings, standalone speech requests and Call Control actions have different contracts; do not transfer provider fields or response formats between them.

## Hosted AI Assistants

For a new assistant, follow [voice-ai-agent](https://telnyx.com/.well-known/agent-skills/voice-ai-agent/SKILL.md) and omit `voice_settings` and `transcription` to use current defaults. Inspect the resulting configuration with `GET /v2/ai/assistants/{assistant_id}`.

When the task requires an explicit configuration:

- TTS uses `voice_settings.voice`; STT uses `transcription.model` and supported language/settings fields.
- Read the [assistant request schema](https://github.com/team-telnyx/ai/blob/main/skills/telnyx-ai-assistants-curl/references/api-details.md) before updating the assistant with `POST /v2/ai/assistants/{assistant_id}`.
- Discover voices through `GET /v2/text-to-speech/voices` and [available voice documentation](https://developers.telnyx.com/docs/voice/tts/available-voices). Confirm assistant support and any required integration secret for the selected provider.
- Verify the configuration through an actual assistant conversation. A standalone TTS response alone does not test turn-taking, interruptions or tool behavior.

The [realtime conversation guide](https://developers.telnyx.com/docs/inference/ai-assistants/realtime-conversations) documents the assistant WebSocket protocol. Keep the account API key on a trusted server.

## Standalone speech generation

Use the current voices endpoint to choose a supported voice identifier. The example requires `TTS_VOICE` to be the full identifier for a selected Telnyx voice; do not use a placeholder or guess a voice name.

```bash
curl --fail-with-body --max-time 30 -sS \
  https://api.telnyx.com/v2/text-to-speech/voices \
  -H "Authorization: Bearer $TELNYX_API_KEY"
```

Generate a short MP3 after selecting the voice. This is billable and requires `jq`:

```bash
: "${TTS_VOICE:?Set TTS_VOICE to a supported Telnyx voice identifier}"
curl --fail-with-body --max-time 30 -sS \
  https://api.telnyx.com/v2/text-to-speech/speech \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H 'Content-Type: application/json' \
  -d "$(jq -n --arg voice "$TTS_VOICE" '{voice: $voice, text: "Hello! How can I help?", output_type: "binary_output", telnyx: {response_format: "mp3"}}')" \
  --output greeting.mp3
```

## Standalone file transcription

Use `POST /v2/ai/audio/transcriptions` with multipart form data. Select a supported transcription model from the current [OpenAPI schema](https://github.com/team-telnyx/openapi/blob/master/openapi/spec3.json), supply either a local file or `file_url`, and respect that model's formats/languages. Assistant streaming STT models are not automatically valid file-transcription models.

```bash
: "${TRANSCRIPTION_MODEL:?Choose a supported file-transcription model}"
curl --fail-with-body --max-time 60 -sS \
  https://api.telnyx.com/v2/ai/audio/transcriptions \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -F 'file=@sample.wav' \
  --form-string "model=$TRANSCRIPTION_MODEL" \
  --form-string 'response_format=json'
```

For streaming speech or Call Control, follow the current endpoint's documentation for authentication, framing, sample rate and events. Do not infer a WebSocket URL from a REST URL.

## Validation and cost

Test with authorized sample audio in the target language, verify the returned transcript or playable audio, and measure latency for the actual configuration. Provider options and latency vary; there is no universal sub-200ms guarantee. Standalone speech pricing is separate from the hosted assistant voice-engine subtotal; see [Voice AI pricing](https://telnyx.com/pricing/voice-ai-agents).
