Skip to main content

fishaudio.resources.voices

Voice management namespace client.

VoicesClient Objects

Synchronous voice management operations.

list

List available voices/models. Arguments:
  • page_size - Number of results per page
  • page_number - Page number (1-indexed)
  • title - Filter by title
  • tags - Filter by tags (single tag or list)
  • self_only - Only return user’s own voices
  • author_id - Filter by author ID
  • language - Filter by language(s)
  • title_language - Filter by title language(s)
  • sort_by - Sort field (“task_count” or “created_at”)
  • request_options - Request-level overrides
Returns: Paginated response with total count and voice items Example:

get

Get voice by ID. Arguments:
  • voice_id - Voice model ID
  • request_options - Request-level overrides
Returns: Voice model details Example:

create

Create/clone a new voice. Arguments:
  • title - Voice model name
  • voices - List of audio file bytes for training
  • description - Voice description
  • texts - Transcripts for voice samples
  • tags - Tags for categorization
  • cover_image - Cover image bytes
  • visibility - Visibility setting (public, unlist, private)
  • train_mode - Training mode (currently only “fast” supported)
  • enhance_audio_quality - Whether to enhance audio quality
  • request_options - Request-level overrides
Returns: Created voice model Example:

update

Update voice metadata. Arguments:
  • voice_id - Voice model ID
  • title - New title
  • description - New description
  • cover_image - New cover image bytes
  • visibility - New visibility setting
  • tags - New tags
  • request_options - Request-level overrides
Example:

delete

Delete a voice. Arguments:
  • voice_id - Voice model ID
  • request_options - Request-level overrides
Example:

AsyncVoicesClient Objects

Asynchronous voice management operations.

list

List available voices/models (async). See sync version for details.

get

Get voice by ID (async). See sync version for details.

create

Create/clone a new voice (async). See sync version for details.

update

Update voice metadata (async). See sync version for details.

delete

Delete a voice (async). See sync version for details.

fishaudio.resources.realtime

Real-time WebSocket streaming helpers.

iter_websocket_audio

Process WebSocket audio messages (sync). Receives messages from WebSocket, yields audio chunks, handles errors. Unknown events are ignored and iteration continues. Arguments:
  • ws - WebSocket connection from httpx_ws.connect_ws
Yields: Audio bytes Raises:
  • WebSocketError - On disconnect or error finish event

aiter_websocket_audio

Process WebSocket audio messages (async). Receives messages from WebSocket, yields audio chunks, handles errors. Unknown events are ignored and iteration continues. Arguments:
  • ws - WebSocket connection from httpx_ws.aconnect_ws
Yields: Audio bytes Raises:
  • WebSocketError - On disconnect or error finish event

fishaudio.resources.tts

TTS (Text-to-Speech) namespace client.

TTSClient Objects

Synchronous TTS operations.

stream

Stream text-to-speech audio chunks. Arguments:
  • text - Text to synthesize
  • reference_id - Voice reference ID (overrides config.reference_id if provided)
  • references - Reference audio samples (overrides config.references if provided)
  • format - Audio format - “mp3”, “wav”, “pcm”, or “opus” (overrides config.format if provided)
  • latency - Latency mode - “normal” or “balanced” (overrides config.latency if provided)
  • speed - Speech speed multiplier, e.g. 1.5 for 1.5x speed (overrides config.prosody.speed if provided)
  • config - TTS configuration (audio settings, voice, model parameters)
  • model - TTS model to use
  • request_options - Request-level overrides
Returns: AudioStream object that can be iterated for audio chunks Example:

convert

Convert text to speech and return complete audio as bytes. This is a convenience method that streams all audio chunks and combines them. For chunk-by-chunk processing, use stream() instead. Arguments:
  • text - Text to synthesize
  • reference_id - Voice reference ID (overrides config.reference_id if provided)
  • references - Reference audio samples (overrides config.references if provided)
  • format - Audio format - “mp3”, “wav”, “pcm”, or “opus” (overrides config.format if provided)
  • latency - Latency mode - “normal” or “balanced” (overrides config.latency if provided)
  • speed - Speech speed multiplier, e.g. 1.5 for 1.5x speed (overrides config.prosody.speed if provided)
  • config - TTS configuration (audio settings, voice, model parameters)
  • model - TTS model to use
  • request_options - Request-level overrides
Returns: Complete audio as bytes Example:

stream_websocket

Stream text and receive audio in real-time via WebSocket. Perfect for conversational AI, live captioning, and streaming applications. Arguments:
  • text_stream - Iterator of text chunks to stream
  • reference_id - Voice reference ID (overrides config.reference_id if provided)
  • references - Reference audio samples (overrides config.references if provided)
  • format - Audio format - “mp3”, “wav”, “pcm”, or “opus” (overrides config.format if provided)
  • latency - Latency mode - “normal” or “balanced” (overrides config.latency if provided)
  • speed - Speech speed multiplier, e.g. 1.5 for 1.5x speed (overrides config.prosody.speed if provided)
  • config - TTS configuration (audio settings, voice, model parameters)
  • model - TTS model to use
  • max_workers - ThreadPoolExecutor workers for concurrent sender
  • ws_options - WebSocket connection options for configuring timeouts, message size limits, etc. Useful for long-running generations that may exceed default timeout values. See WebSocketOptions class for available parameters.
Returns: Iterator of audio bytes Example:

AsyncTTSClient Objects

Asynchronous TTS operations.

stream

Stream text-to-speech audio chunks (async). Arguments:
  • text - Text to synthesize
  • reference_id - Voice reference ID (overrides config.reference_id if provided)
  • references - Reference audio samples (overrides config.references if provided)
  • format - Audio format - “mp3”, “wav”, “pcm”, or “opus” (overrides config.format if provided)
  • latency - Latency mode - “normal” or “balanced” (overrides config.latency if provided)
  • speed - Speech speed multiplier, e.g. 1.5 for 1.5x speed (overrides config.prosody.speed if provided)
  • config - TTS configuration (audio settings, voice, model parameters)
  • model - TTS model to use
  • request_options - Request-level overrides
Returns: AsyncAudioStream object that can be iterated for audio chunks Example:

convert

Convert text to speech and return complete audio as bytes (async). This is a convenience method that streams all audio chunks and combines them. For chunk-by-chunk processing, use stream() instead. Arguments:
  • text - Text to synthesize
  • reference_id - Voice reference ID (overrides config.reference_id if provided)
  • references - Reference audio samples (overrides config.references if provided)
  • format - Audio format - “mp3”, “wav”, “pcm”, or “opus” (overrides config.format if provided)
  • latency - Latency mode - “normal” or “balanced” (overrides config.latency if provided)
  • speed - Speech speed multiplier, e.g. 1.5 for 1.5x speed (overrides config.prosody.speed if provided)
  • config - TTS configuration (audio settings, voice, model parameters)
  • model - TTS model to use
  • request_options - Request-level overrides
Returns: Complete audio as bytes Example:

stream_websocket

Stream text and receive audio in real-time via WebSocket (async). Perfect for conversational AI, live captioning, and streaming applications. Arguments:
  • text_stream - Async iterator of text chunks to stream
  • reference_id - Voice reference ID (overrides config.reference_id if provided)
  • references - Reference audio samples (overrides config.references if provided)
  • format - Audio format - “mp3”, “wav”, “pcm”, or “opus” (overrides config.format if provided)
  • latency - Latency mode - “normal” or “balanced” (overrides config.latency if provided)
  • speed - Speech speed multiplier, e.g. 1.5 for 1.5x speed (overrides config.prosody.speed if provided)
  • config - TTS configuration (audio settings, voice, model parameters)
  • model - TTS model to use
  • ws_options - WebSocket connection options for configuring timeouts, message size limits, etc. Useful for long-running generations that may exceed default timeout values. See WebSocketOptions class for available parameters.
Returns: Async iterator of audio bytes Example:

fishaudio.resources.account

Account namespace client for billing and credits.

AccountClient Objects

Synchronous account operations.

get_credits

Get API credit balance. Arguments:
  • check_free_credit - Whether to check free credit availability
  • request_options - Request-level overrides
Returns: Credits information Example:

get_package

Get package information. Arguments:
  • request_options - Request-level overrides
Returns: Package information Example:

AsyncAccountClient Objects

Asynchronous account operations.

get_credits

Get API credit balance (async). Arguments:
  • check_free_credit - Whether to check free credit availability
  • request_options - Request-level overrides
Returns: Credits information Example:

get_package

Get package information (async). Arguments:
  • request_options - Request-level overrides
Returns: Package information Example:

fishaudio.resources.asr

ASR (Automatic Speech Recognition) namespace client.

ASRClient Objects

Synchronous ASR operations.

transcribe

Transcribe audio to text. Arguments:
  • audio - Audio file bytes
  • language - Language code (e.g., “en”, “zh”). Auto-detected if not provided.
  • include_timestamps - Whether to include timestamp information for segments
  • request_options - Request-level overrides
Returns: ASRResponse with transcription text, duration, and segments Example:

AsyncASRClient Objects

Asynchronous ASR operations.

transcribe

Transcribe audio to text (async). Arguments:
  • audio - Audio file bytes
  • language - Language code (e.g., “en”, “zh”). Auto-detected if not provided.
  • include_timestamps - Whether to include timestamp information for segments
  • request_options - Request-level overrides
Returns: ASRResponse with transcription text, duration, and segments Example: