> ## Documentation Index
> Fetch the complete documentation index at: https://typecast.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Instant cloning

> Clone a custom voice from a short audio sample and use it like any built-in voice in subsequent text-to-speech calls.

Upload a WAV or MP3 file (max 25 MB). The server extracts a speaker embedding and returns a custom voice ID with the `uc_` prefix that can be passed directly to `POST /v1/text-to-speech` (and any other endpoint that accepts a `voice_id`). The original audio is uploaded to S3 in the background after the response is returned.

**Limits**

- Audio file: max 25 MB. Supported formats: WAV, MP3.
- Audio duration: 5 to 150 seconds.
- Voice name: 1-30 characters.
- Model: `ssfm-v21` or `ssfm-v30`. The cloned voice is bound to this engine model.
- Each plan has a maximum number of active custom voices (the `custom_voice_slot`). Use `DELETE /v1/voices/{voice_id}` to free a slot.

**Typical flow**

1. `POST /v1/voices/clone` with the sample audio → receive `voice_id` (e.g. `uc_64a1b2...`).
2. `POST /v1/text-to-speech` with `voice_id` set to the cloned ID.
3. `DELETE /v1/voices/{voice_id}` when you no longer need the voice.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/voices/clone
openapi: 3.1.0
info:
  title: Typecast API
  version: 0.1.2
  x-logo:
    url: https://typecast.ai/_ipx/_/image/logo/tc_logo.webp
servers:
  - url: https://api.typecast.ai
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /v1/voices/clone:
    post:
      tags:
        - Voices
      summary: Instant cloning
      description: >-
        Clone a custom voice from a short audio sample and use it like any
        built-in voice in subsequent text-to-speech calls.


        Upload a WAV or MP3 file (max 25 MB). The server extracts a speaker
        embedding and returns a custom voice ID with the `uc_` prefix that can
        be passed directly to `POST /v1/text-to-speech` (and any other endpoint
        that accepts a `voice_id`). The original audio is uploaded to S3 in the
        background after the response is returned.


        **Limits**


        - Audio file: max 25 MB. Supported formats: WAV, MP3.

        - Audio duration: 5 to 150 seconds.

        - Voice name: 1-30 characters.

        - Model: `ssfm-v21` or `ssfm-v30`. The cloned voice is bound to this
        engine model.

        - Each plan has a maximum number of active custom voices (the
        `custom_voice_slot`). Use `DELETE /v1/voices/{voice_id}` to free a slot.


        **Typical flow**


        1. `POST /v1/voices/clone` with the sample audio → receive `voice_id`
        (e.g. `uc_64a1b2...`).

        2. `POST /v1/text-to-speech` with `voice_id` set to the cloned ID.

        3. `DELETE /v1/voices/{voice_id}` when you no longer need the voice.
      operationId: create_voice_clone_v1_voices_clone_post
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: >-
                #/components/schemas/Body_create_voice_clone_v1_voices_clone_post
              type: object
              required:
                - file
                - name
                - model
              properties:
                file:
                  type: string
                  format: binary
                  description: Audio sample. WAV or MP3, max 25 MB, 5-150 seconds.
                name:
                  type: string
                  minLength: 1
                  maxLength: 30
                  description: Voice name (1-30 characters).
                model:
                  type: string
                  enum:
                    - ssfm-v21
                    - ssfm-v30
                  description: Engine model to clone the voice for.
        required: true
      responses:
        '200':
          description: Successful Response - Custom voice created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomVoiceResponse'
              example:
                voice_id: uc_64a1b2c3d4e5f6a7b8c9d0e1
                name: my-voice
                model: ssfm-v30
        '400':
          description: >-
            Bad Request - Invalid audio file, file size, duration, or other
            validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                file_too_large:
                  summary: File is too large
                  value:
                    detail: File size exceeds maximum limit
                audio_too_short:
                  summary: Audio is shorter than 5 seconds
                  value:
                    detail: Audio duration is below minimum
                audio_too_long:
                  summary: Audio is longer than 150 seconds
                  value:
                    detail: Audio duration exceeds maximum
                audio_unreadable:
                  summary: Audio metadata cannot be read
                  value:
                    detail: Failed to read audio metadata
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                detail: Invalid API key
        '403':
          description: Forbidden - Voice cloning is not available on your plan
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                detail: Voice cloning is not available on your plan
        '422':
          description: Validation Error - Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                detail: Invalid request format
        '429':
          description: Too Many Requests - Rate limit or concurrency limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                detail: Too many requests
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |
            curl --request POST \
              --url 'https://api.typecast.ai/v1/voices/clone' \
              --header 'X-API-KEY: <api-key>' \
              -F 'file=@sample.wav' \
              -F 'name=my-voice' \
              -F 'model=ssfm-v30'
        - lang: Python
          label: Python (requests)
          source: >
            import requests


            with open("sample.wav", "rb") as f:
                response = requests.post(
                    "https://api.typecast.ai/v1/voices/clone",
                    headers={"X-API-KEY": "<api-key>"},
                    files={"file": ("sample.wav", f, "audio/wav")},
                    data={"name": "my-voice", "model": "ssfm-v30"},
                )

            print(response.json())

            # {"voice_id": "uc_64a1b2c3d4e5f6a7b8c9d0e1", "name": "my-voice",
            "model": "ssfm-v30"}
components:
  schemas:
    Body_create_voice_clone_v1_voices_clone_post:
      type: object
      properties:
        file:
          type: string
          title: File
          description: Audio sample. WAV or MP3, max 25 MB, 5-150 seconds.
          contentMediaType: application/octet-stream
          format: binary
        name:
          type: string
          title: Name
          description: Voice name (1-30 characters).
          maxLength: 30
          minLength: 1
        model:
          $ref: '#/components/schemas/TTSModel'
          description: Engine model the voice is cloned for (`ssfm-v21` or `ssfm-v30`).
          allOf:
            - $ref: '#/components/schemas/TTSModel'
      required:
        - file
        - name
        - model
      title: Body_create_voice_clone_v1_voices_clone_post
      description: Multipart request body for instant cloning.
    CustomVoiceResponse:
      type: object
      properties:
        voice_id:
          type: string
          title: Voice Id
          description: >-
            Custom voice identifier with the `uc_` prefix. Use this value as
            `voice_id` in `POST /v1/text-to-speech` and other endpoints that
            accept `voice_id`.
          example: uc_64a1b2c3d4e5f6a7b8c9d0e1
        name:
          type: string
          title: Name
          description: Human-readable voice name (1-30 characters).
        model:
          type: string
          title: Model
          description: Engine model the voice was cloned for (`ssfm-v21` or `ssfm-v30`).
          allOf:
            - $ref: '#/components/schemas/TTSModel'
      required:
        - voice_id
        - name
        - model
      title: CustomVoiceResponse
      description: >-
        Response of `POST /v1/voices/clone` — custom voice metadata returned by
        instant cloning.
    ErrorResponse:
      type: object
      properties:
        detail:
          type: string
          description: Error message describing the issue
      required:
        - detail
      example:
        detail: An error occurred processing the request
    TTSModel:
      type: string
      enum:
        - ssfm-v30
        - ssfm-v21
      title: TTSModel
      description: >
        TTS model version to use for speech synthesis. Different models offer
        varying capabilities and quality levels.


        Available models:

        - **ssfm-v30**: Latest model with improved prosody and additional
        emotion presets (recommended)

        - **ssfm-v21**: Stable production model with proven reliability and
        consistent quality
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: >-
        API key for authentication. You can obtain an API key from the Typecast
        API Console.

````