Skip to main content

Overview

This guide will walk you through generating your first text-to-speech audio with Fish Audio. By the end, you’ll have converted text into natural-sounding speech using our API.
Already using the OpenAI, OpenRouter, ElevenLabs, or Groq SDK? Swap in a Fish Audio base URL and API key and it keeps working. Migrate to Fish Audio has the URL for each SDK.

Prerequisites

Sign up for a free Fish Audio account to get started with our API.
  1. Sign up on fish.audio
  2. Fill in your details to create an account, complete steps to verify your account.
  3. Log in to your account and open Get Started
Once you have an account, you’ll need an API key to authenticate your requests.
  1. Log in and open Get Started
  2. Click “Get your API key”: the key is created in one click and shown only once
  3. Copy your key and store it securely
Keep your API key secret! Never commit it to version control or share it publicly.

Your First TTS Request

The examples on this page use the free s2.1-pro-free model, so they work on a new account before you add any API credit. Choose your preferred method to generate speech:
1

Set your API key

Store your API key as an environment variable (recommended approach):
2

Make the TTS request

Run this cURL command to generate your first speech:
3

Play your audio

The audio has been saved as welcome.mp3. You can play it by:
  • Double-clicking the file or opening it in any media player
  • Or using the command line:

If your first request fails

See Errors for the full table and retry handling.

Customizing Your Voice

The examples above use the default voice. To use a different voice, add the reference_id parameter with a model ID from fish.audio. You can find the model ID in the URL or use the copy button when viewing any voice. Choose a voice to try:
From: https://fish.audio/m/ca3007f96ae7499ab87d27ea3599956a
Then generate speech with your chosen voice:

Support

Need help? Check out these resources: