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.

Prerequisites

Sign up for a free Fish Audio account to get started with our API.
  1. Go to fish.audio/auth/signup
  2. Fill in your details to create an account, complete steps to verify your account.
  3. Log in to your account and navigate to the API section
Once you have an account, you’ll need an API key to authenticate your requests.
  1. Log in to your Fish Audio Dashboard
  2. Navigate to the API Keys section
  3. Click “Create New Key” and give it a descriptive name, set a expiration if desired
  4. 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

Choose your preferred method to generate speech:
  • cURL
  • Python
1

Set your API key

Store your API key as an environment variable (recommended approach):
export FISH_API_KEY="replace_me"
2

Make the TTS request

Run this cURL command to generate your first speech:
curl -X POST https://api.fish.audio/v1/tts \
  -H "Authorization: Bearer $FISH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "model: s1" \
  -d '{
    "text": "Hello! Welcome to Fish Audio. This is my first AI-generated voice.",
    "format": "mp3"
  }' \
  --output welcome.mp3
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:
# On macOS
afplay welcome.mp3

# On Linux
mpg123 welcome.mp3

# On Windows
start welcome.mp3

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:
  • E-Girl Voice
  • Energetic Male
From: https://fish.audio/m/8ef4a238714b45718ce04243307c57a7
export REFERENCE_ID="8ef4a238714b45718ce04243307c57a7"
Then generate speech with your chosen voice:
  • cURL
  • Python
curl -X POST https://api.fish.audio/v1/tts \
  -H "Authorization: Bearer $FISH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "model: s1" \
  -d '{
    "text": "This is a custom voice from Fish Audio! You can explore hundreds of different voices on the platform, or even create your own.",
    "reference_id": "'"$REFERENCE_ID"'",
    "format": "mp3"
  }' \
  --output custom_voice.mp3

Support

Need help? Check out these resources: