openapi: 3.0.3
info:
  title: Voice API
  version: 1.0.0
  description: APIs for voice upload, transcription, and text-to-speech synthesis.
  x-gitbook-description-html: <p>APIs for voice upload, transcription, and text-to-speech synthesis.</p>
  x-gitbook-description-document:
    object: document
    data:
      schemaVersion: 9
    nodes:
      - object: block
        type: paragraph
        isVoid: false
        data: {}
        nodes:
          - object: text
            leaves:
              - object: leaf
                text: >-
                  APIs for voice upload, transcription, and text-to-speech
                  synthesis.
                marks: []
            key: dOCA9p3gmpii
        key: Ra3ounrfjbrl
    key: zwUlbBEZ9mYW
servers:
  - url: https://noiz.ai/v1
    description: Production server
    x-gitbook-description-html: <p>Production server</p>
security:
  - ApiKeyAuth: []
paths:
  /voices:
    get:
      operationId: listVoices
      tags:
        - Voices
      summary: Get user voices or system voices
      description: Supports pagination and filtering by voice type.
      parameters:
        - in: query
          name: voice_type
          schema:
            type: string
            enum:
              - custom
              - built-in
            default: custom
          description: >-
            Voice type filter. "custom" for user-created voices (default),
            "built-in" for system voices.
          x-gitbook-description-html: >-
            <p>Voice type filter. "custom" for user-created voices (default),
            "built-in" for system voices.</p>
        - in: query
          name: keyword
          schema:
            type: string
          description: Search keyword (searches voice name, description, labels)
          x-gitbook-description-html: <p>Search keyword (searches voice name, description, labels)</p>
        - in: query
          name: skip
          schema:
            type: integer
            default: 0
          description: Page number (starts from 0)
          x-gitbook-description-html: <p>Page number (starts from 0)</p>
        - in: query
          name: limit
          schema:
            type: integer
            default: 10
          description: Maximum number of items to return per page
          x-gitbook-description-html: <p>Maximum number of items to return per page</p>
      x-codeSamples:
        - lang: http
          label: HTTP - Get user voices
          source: |
            GET /v1/voices?skip=0&limit=10 HTTP/1.1
            Host: noiz.ai
            Authorization: YOUR_API_KEY
            Accept: */*
        - lang: http
          label: HTTP - Get system voices
          source: |
            GET /v1/voices?voice_type=built-in&skip=0&limit=10 HTTP/1.1
            Host: noiz.ai
            Authorization: YOUR_API_KEY
            Accept: */*
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      total_count:
                        type: integer
                      voices:
                        type: array
                        items:
                          $ref: '#/components/schemas/Voice'
          x-gitbook-description-html: <p>Success</p>
        '400':
          description: Invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              examples:
                limit_too_high:
                  summary: Limit exceeds maximum
                  value:
                    code: 400
                    message: limit must be < 110
          x-gitbook-description-html: <p>Invalid parameters</p>
        '401':
          $ref: '#/components/responses/UnauthorizedError'
      x-gitbook-description-html: <p>Supports pagination and filtering by voice type.</p>
      x-gitbook-description-document:
        object: document
        data:
          schemaVersion: 9
        nodes:
          - object: block
            type: paragraph
            isVoid: false
            data: {}
            nodes:
              - object: text
                leaves:
                  - object: leaf
                    text: Supports pagination and filtering by voice type.
                    marks: []
                key: HyjvpCoAeFLM
            key: 1Cm58G4d1Stz
        key: vraZq6q4Bu1t
    post:
      operationId: cloneVoice
      tags:
        - Voices
      summary: Clone a voice
      description: >-
        Clone a voice by uploading an audio file or providing an audio URL. 
        Provide either file (upload) or voice_url (remote URL), at least one is
        required. Only WAV, MP3, and M4A formats are supported.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                  description: >-
                    Audio file to upload (WAV, MP3, or M4A). Either file or
                    voice_url must be provided.
                  x-gitbook-description-html: >-
                    <p>Audio file to upload (WAV, MP3, or M4A). Either file or
                    voice_url must be provided.</p>
                voice_url:
                  type: string
                  description: >-
                    URL to a remote audio file (WAV, MP3, or M4A). Either file
                    or voice_url must be provided.
                  x-gitbook-description-html: >-
                    <p>URL to a remote audio file (WAV, MP3, or M4A). Either
                    file or voice_url must be provided.</p>
                display_name:
                  type: string
                  description: Display name for the cloned voice
                  x-gitbook-description-html: <p>Display name for the cloned voice</p>
                denoise:
                  type: boolean
                  description: Whether to apply noise reduction to the audio
                  x-gitbook-description-html: <p>Whether to apply noise reduction to the audio</p>
                language:
                  type: string
                  description: Language of the audio (e.g. "en", "zh")
                  x-gitbook-description-html: <p>Language of the audio (e.g. "en", "zh")</p>
      x-codeSamples:
        - lang: http
          label: HTTP - Upload file
          source: |
            POST /v1/voices HTTP/1.1
            Host: noiz.ai
            Authorization: YOUR_API_KEY
            Content-Type: multipart/form-data
            Accept: */*

            file=@voice.wav&display_name=My Voice
        - lang: http
          label: HTTP - Clone from URL
          source: |
            POST /v1/voices HTTP/1.1
            Host: noiz.ai
            Authorization: YOUR_API_KEY
            Content-Type: multipart/form-data
            Accept: */*

            voice_url=https://example.com/voice.wav&display_name=My Voice
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    description: Status code (0 = success)
                    x-gitbook-description-html: <p>Status code (0 = success)</p>
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      voice_id:
                        type: string
                      voice_display_name:
                        type: string
                      duration:
                        type: integer
                      selected_text:
                        type: string
                      selected_start:
                        type: number
                        format: float
                      selected_end:
                        type: number
                        format: float
                      text:
                        type: string
                      language:
                        type: string
          x-gitbook-description-html: <p>Success</p>
        '400':
          description: Invalid request / processing error
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              examples:
                file_or_url_missing:
                  summary: Neither file nor voice_url provided
                  value:
                    code: 400
                    message: Either file or voice_url must be provided.
                unsupported_format:
                  summary: Unsupported audio format
                  value:
                    code: 400
                    message: >-
                      Unsupported audio format. Only WAV, MP3, and M4A are
                      supported.
                url_download_failed:
                  summary: Failed to download audio from URL
                  value:
                    code: 400
                    message: >-
                      Failed to download audio from URL: URL download timed out
                      after 30s
                file_too_large:
                  summary: Uploaded file too large
                  value:
                    code: 400
                    message: file exceeds maximum size
                invalid_audio:
                  summary: Audio validation failed
                  value:
                    code: 400
                    message: invalid audio format
                multiple_speakers:
                  summary: Multiple speakers detected
                  value:
                    code: 400
                    message: multiple speakers detected
                recognition_failed:
                  summary: ASR recognition failed
                  value:
                    code: 400
                    message: voice recognition failed
                user_pending:
                  summary: User pending verification
                  value:
                    code: 400
                    message: user pending verification
                credit_limit_exceeded:
                  summary: User credit insufficient
                  value:
                    code: 400
                    message: API key credit limit exceeded
                voice_create_failed:
                  summary: Voice creation failed
                  value:
                    code: 400
                    message: voice creation failed
          x-gitbook-description-html: <p>Invalid request / processing error</p>
        '401':
          $ref: '#/components/responses/UnauthorizedError'
      x-gitbook-description-html: >-
        <p>Clone a voice by uploading an audio file or providing an audio URL.
        Provide either file (upload) or voice_url (remote URL), at least one is
        required. Only WAV, MP3, and M4A formats are supported.</p>
      x-gitbook-description-document:
        object: document
        data:
          schemaVersion: 9
        nodes:
          - object: block
            type: paragraph
            isVoid: false
            data: {}
            nodes:
              - object: text
                leaves:
                  - object: leaf
                    text: >-
                      Clone a voice by uploading an audio file or providing an
                      audio URL. Provide either file (upload) or voice_url
                      (remote URL), at least one is required. Only WAV, MP3, and
                      M4A formats are supported.
                    marks: []
                key: WLFF7pFNDxZX
            key: Px3AcTwjR4Rr
        key: wgUpVMXA432o
  /voices/{voice_id}:
    get:
      operationId: getVoice
      tags:
        - Voices
      summary: Get voice details
      parameters:
        - in: path
          name: voice_id
          required: true
          schema:
            type: string
      x-codeSamples:
        - lang: http
          label: HTTP
          source: |
            GET /v1/voices/{voice_id} HTTP/1.1
            Host: noiz.ai
            Authorization: YOUR_API_KEY
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
                  data:
                    $ref: '#/components/schemas/Voice'
          x-gitbook-description-html: <p>Success</p>
        '400':
          description: Invalid parameters
          x-gitbook-description-html: <p>Invalid parameters</p>
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          description: Voice not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 404
                message: Voice file not found
          x-gitbook-description-html: <p>Voice not found</p>
    delete:
      operationId: deleteVoice
      tags:
        - Voices
      summary: Delete a voice (soft delete)
      description: >-
        Soft delete a voice by setting delete_time. The voice won't be
        physically removed from storage.
      parameters:
        - in: path
          name: voice_id
          required: true
          schema:
            type: string
          description: The ID of the voice to delete
          x-gitbook-description-html: <p>The ID of the voice to delete</p>
      x-codeSamples:
        - lang: http
          label: HTTP
          source: |
            DELETE /v1/voices/{voice_id} HTTP/1.1
            Host: noiz.ai
            Authorization: YOUR_API_KEY
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      voice_id:
                        type: string
                        description: The deleted voice ID
                        x-gitbook-description-html: <p>The deleted voice ID</p>
                      display_name:
                        type: string
                        description: The display name of the deleted voice
                        x-gitbook-description-html: <p>The display name of the deleted voice</p>
                      delete_time:
                        type: integer
                        description: Unix timestamp when the voice was deleted
                        x-gitbook-description-html: <p>Unix timestamp when the voice was deleted</p>
              example:
                code: 0
                message: success
                data:
                  voice_id: abc123def456
                  display_name: My Custom Voice
                  delete_time: 1738664823
          x-gitbook-description-html: <p>Success</p>
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          description: Voice not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 404
                message: Voice not found
          x-gitbook-description-html: <p>Voice not found</p>
      x-gitbook-description-html: >-
        <p>Soft delete a voice by setting delete_time. The voice won't be
        physically removed from storage.</p>
      x-gitbook-description-document:
        object: document
        data:
          schemaVersion: 9
        nodes:
          - object: block
            type: paragraph
            isVoid: false
            data: {}
            nodes:
              - object: text
                leaves:
                  - object: leaf
                    text: >-
                      Soft delete a voice by setting delete_time. The voice
                      won't be physically removed from storage.
                    marks: []
                key: nN2gvdLzdOc8
            key: wgXVQigORwBj
        key: IFAAzgBXkuZ5
  /text-to-speech:
    post:
      operationId: textToSpeech
      tags:
        - Text to Speech
      summary: Convert text to speech
      description: >-
        Convert text to speech using a specified voice. Supports emotion
        control, speed adjustment, and multiple output formats. Emotion and
        tone word tags such as `[happy]` are meant for `model_id=v3` and only
        apply when `stream` is not set. The default models (v1/v2) use a
        different tag format and support 13 emotions. See the
        [tag list](/docs-emotion-tags).
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - text
              properties:
                text:
                  type: string
                  description: >-
                    Text to convert. Max 5000 chars for non-streaming
                    (stream=false); max 50000 chars for streaming (stream=true).
                  x-gitbook-description-html: >-
                    <p>Text to convert. Max 5000 chars for non-streaming
                    (stream=false); max 50000 chars for streaming
                    (stream=true).</p>
                voice_id:
                  type: string
                  description: Voice ID to use for synthesis
                  x-gitbook-description-html: <p>Voice ID to use for synthesis</p>
                file:
                  type: string
                  format: binary
                  description: Audio file for voice cloning (alternative to voice_id)
                  x-gitbook-description-html: >-
                    <p>Audio file for voice cloning (alternative to
                    voice_id)</p>
                model_id:
                  type: string
                  enum:
                    - v1
                    - v2
                    - v3
                  description: >-
                    Optional TTS model. Defaults to automatic selection by
                    language, which never picks v3. v3 requires reference audio
                    (file, or a voice_id that has one), supports zh, en, ja, ko, es, pt, fr, de, ru and mixed zh+en
                    in both streaming and non-streaming mode (other languages use multilingual fallback),
                    outputs 48 kHz WAV, and clamps speed to 0.5-2.0. Invalid
                    values return code 400.
                  x-gitbook-description-html: >-
                    <p>Optional TTS model. Defaults to automatic selection by
                    language, which never picks v3. v3 requires reference audio
                    (<code>file</code>, or a <code>voice_id</code> that has
                    one), supports zh, en, ja, ko, es, pt, fr, de, ru and mixed zh+en
                    in both streaming and non-streaming mode (other languages use multilingual fallback), outputs 48 kHz WAV, and clamps
                    <code>speed</code> to 0.5-2.0. Invalid values return code
                    400.</p>
                quality_preset:
                  type: integer
                  default: 3
                  description: Quality preset for synthesis
                  x-gitbook-description-html: <p>Quality preset for synthesis</p>
                output_format:
                  type: string
                  enum:
                    - wav
                    - mp3
                  default: wav
                  description: Output audio format (wav/mp3)
                  x-gitbook-description-html: <p>Output audio format (wav/mp3)</p>
                speed:
                  type: number
                  default: 1
                  description: Speech speed multiplier
                  x-gitbook-description-html: <p>Speech speed multiplier</p>
                duration:
                  type: number
                  default: 0
                  description: Target audio duration in seconds
                  x-gitbook-description-html: <p>Target audio duration in seconds</p>
                target_lang:
                  type: string
                  description: Target language code (e.g., "zh", "en", "zh+en")
                  x-gitbook-description-html: <p>Target language code (e.g., "zh", "en", "zh+en")</p>
                similarity_enh:
                  type: boolean
                  default: false
                  description: Whether to enhance voice similarity
                  x-gitbook-description-html: <p>Whether to enhance voice similarity</p>
                emo:
                  type: string
                  description: >-
                    Emotion parameters as JSON string, e.g., {"Sadness":0.2,
                    "Happy":0.5}
                  x-gitbook-description-html: >-
                    <p>Emotion parameters as JSON string, e.g., {"Sadness":0.2,
                    "Happy":0.5}</p>
                trim_silence:
                  type: boolean
                  default: false
                  description: >-
                    Whether to trim leading and trailing silence from the
                    generated audio
                  x-gitbook-description-html: >-
                    <p>Whether to trim leading and trailing silence from the
                    generated audio</p>
                save_voice:
                  type: boolean
                  default: false
                  description: Whether to save the uploaded voice file
                  x-gitbook-description-html: <p>Whether to save the uploaded voice file</p>
                stream:
                  type: boolean
                  default: false
                  description: >-
                    Whether to return audio as a real-time chunked stream.
                    When false (default): waits for full synthesis and returns the
                    complete audio file; supports all output formats; max 5000 chars.
                    When true: returns a chunked WAV stream for low-latency playback;
                    billing is charged at connection establishment; max 50000 chars.
                  x-gitbook-description-html: >-
                    <p>Whether to return audio as a real-time chunked stream.</p>
                    <ul>
                    <li><strong>false</strong> (default): waits for full synthesis
                    and returns the complete audio file; supports all output formats;
                    max 5000 chars.</li>
                    <li><strong>true</strong>: returns a chunked WAV stream for
                    low-latency playback; billing is charged at connection
                    establishment; max 50000 chars.</li>
                    </ul>
      x-codeSamples:
        - lang: http
          label: HTTP - Basic
          source: |
            POST /v1/text-to-speech HTTP/1.1
            Host: noiz.ai
            Authorization: YOUR_API_KEY
            Content-Type: multipart/form-data

            text=Every great story satisfies some kind of hunger, and ours is just getting started.&voice_id=abc123
        - lang: http
          label: HTTP - With emotion
          source: |
            POST /v1/text-to-speech HTTP/1.1
            Host: noiz.ai
            Authorization: YOUR_API_KEY
            Content-Type: multipart/form-data

            text=Every great story satisfies some kind of hunger, and ours is just getting started.&voice_id=abc123&emo={"Joy":0.8}
        - lang: http
          label: HTTP - Streaming
          source: |
            POST /v1/text-to-speech HTTP/1.1
            Host: noiz.ai
            Authorization: YOUR_API_KEY
            Content-Type: multipart/form-data

            text=Every great story satisfies some kind of hunger, and ours is just getting started.&voice_id=abc123&stream=true
      responses:
        '200':
          description: >-
            Success — returns audio binary. When stream=false: complete audio
            file (wav or mp3). When stream=true: chunked WAV stream
            (Transfer-Encoding: chunked).
          headers:
            X-Timestamp:
              description: Unix timestamp in milliseconds when the audio was generated
              schema:
                type: integer
                format: int64
              example: 1738664823000
              x-gitbook-description-html: >-
                <p>Unix timestamp in milliseconds when the audio was
                generated</p>
            X-Audio-Duration:
              description: Audio duration in seconds
              schema:
                type: string
              example: '3.50'
              x-gitbook-description-html: <p>Audio duration in seconds</p>
          content:
            audio/wav:
              schema:
                type: string
                format: binary
            audio/mpeg:
              schema:
                type: string
                format: binary
          x-gitbook-description-html: <p>Success — returns audio binary stream</p>
        '400':
          description: Invalid parameters or processing error
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              examples:
                text_empty:
                  value:
                    code: 400
                    message: text is required
                text_too_long:
                  value:
                    code: 400
                    message: text exceeds max length
                text_sensitive:
                  value:
                    code: 400
                    message: text contains sensitive word
                voice_not_found:
                  value:
                    code: 400
                    message: voice not found
                file_or_voice_missing:
                  value:
                    code: 400
                    message: either file or voice_id must be provided
                output_format_invalid:
                  value:
                    code: 400
                    message: invalid output_format
                file_too_large:
                  value:
                    code: 400
                    message: file exceeds maximum size
                user_pending:
                  value:
                    code: 400
                    message: user pending verification
                user_blocked:
                  value:
                    code: 400
                    message: user blocked
                tts_failed:
                  value:
                    code: 400
                    message: TTS synthesis failed
                credit_limit_exceeded:
                  value:
                    code: 400
                    message: API key credit limit exceeded
          x-gitbook-description-html: <p>Invalid parameters or processing error</p>
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          description: Payment required
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 402
                message: API usage not allowed - insufficient credits
          x-gitbook-description-html: <p>Payment required</p>
        '500':
          description: Internal server error (TTS synthesis failure)
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 500
                message: TTS synthesis failed
          x-gitbook-description-html: <p>Internal server error (TTS synthesis failure)</p>
      x-gitbook-description-html: >-
        <p>Convert text to speech using a specified voice. Supports emotion
        control, speed adjustment, and multiple output formats.</p>
      x-gitbook-description-document:
        object: document
        data:
          schemaVersion: 9
        nodes:
          - object: block
            type: paragraph
            isVoid: false
            data: {}
            nodes:
              - object: text
                leaves:
                  - object: leaf
                    text: >-
                      Convert text to speech using a specified voice. Supports
                      emotion control, speed adjustment, and multiple output
                      formats.
                    marks: []
                key: HZ26RJOlguC2
            key: gYX4ZUJ3q0GI
        key: QNMXeLkH5FFa
  /text-to-speech-large:
    post:
      operationId: textToSpeechLarge
      tags:
        - Text to Speech
      deprecated: true
      summary: "Long-form text to speech (deprecated — use /text-to-speech with stream=true instead)"
      description: >-
        "**Deprecated.** Use POST /text-to-speech with stream=true instead, which supports up to 50,000 characters with real-time chunked streaming. This endpoint is no longer maintained."
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - text
                - voice_id
              properties:
                text:
                  type: string
                  description: Text to convert (max 20,000 chars)
                  x-gitbook-description-html: <p>Text to convert (max 20,000 chars)</p>
                voice_id:
                  type: string
                  description: Voice ID to use for synthesis
                  x-gitbook-description-html: <p>Voice ID to use for synthesis</p>
                output_format:
                  type: string
                  enum:
                    - wav
                    - mp3
                  default: wav
                  description: Output audio format (wav/mp3)
                  x-gitbook-description-html: <p>Output audio format (wav/mp3)</p>
                speed:
                  type: number
                  default: 1.0
                  description: Speech speed multiplier (0.5–2.0)
                  x-gitbook-description-html: <p>Speech speed multiplier (0.5–2.0)</p>
                target_lang:
                  type: string
                  description: Target language code (e.g., "zh", "en")
                  x-gitbook-description-html: <p>Target language code (e.g., "zh", "en")</p>
                quality_preset:
                  type: integer
                  default: 3
                  description: Quality preset for synthesis
                  x-gitbook-description-html: <p>Quality preset for synthesis</p>
                trim_silence:
                  type: boolean
                  default: false
                  description: Whether to trim leading and trailing silence
                  x-gitbook-description-html: <p>Whether to trim leading and trailing silence</p>
      x-codeSamples:
        - lang: http
          label: HTTP - Submit job
          source: |
            POST /v1/text-to-speech-large HTTP/1.1
            Host: noiz.ai
            Authorization: YOUR_API_KEY
            Content-Type: multipart/form-data

            text=Your long text here...&voice_id=abc123&output_format=wav
        - lang: http
          label: HTTP - Poll result
          source: |
            GET /v1/text-to-speech-large/gen_products/{gen_product_id} HTTP/1.1
            Host: noiz.ai
            Authorization: YOUR_API_KEY
      responses:
        '200':
          description: Job submitted successfully — returns gen_product_id for polling
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 0
                  message:
                    type: string
                    example: success
                  data:
                    type: object
                    properties:
                      gen_product_id:
                        type: string
                        description: ID used to poll the job result
                        example: 191_abc123_d618db1d
                      status:
                        type: string
                        description: Initial job status
                        example: PENDING
                      sections:
                        type: array
                        description: Audio segments (empty initially, populated after completion)
                        items:
                          type: object
          x-gitbook-description-html: <p>Job submitted successfully — returns gen_product_id for polling</p>
        '400':
          description: Invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              examples:
                text_empty:
                  value:
                    code: 400
                    message: text is required
                text_too_long:
                  value:
                    code: 400
                    message: text exceeds max length
                voice_not_found:
                  value:
                    code: 404
                    message: voice not found
          x-gitbook-description-html: <p>Invalid parameters</p>
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          description: Payment required
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 402
                message: API usage not allowed - insufficient credits
          x-gitbook-description-html: <p>Payment required</p>
      x-gitbook-description-html: >-
        <p>Submit a long-form text-to-speech task asynchronously. Supports up to
        20,000 characters. Poll the result endpoint with the returned
        gen_product_id to get download URLs when the job is complete.</p>
  /text-to-speech-large/gen_products/{gen_product_id}:
    get:
      operationId: getTextToSpeechLargeResult
      tags:
        - Text to Speech
      deprecated: true
      summary: "Get long-form TTS result (deprecated — see /text-to-speech with stream=true)"
      description: >-
        "**Deprecated.** Companion poll endpoint for the deprecated
        POST /text-to-speech-large. Use POST /text-to-speech with stream=true instead."
      parameters:
        - name: gen_product_id
          in: path
          required: true
          description: The gen_product_id returned from the submit endpoint
          schema:
            type: string
          example: 191_abc123_d618db1d
      x-codeSamples:
        - lang: http
          label: HTTP - Poll result
          source: |
            GET /v1/text-to-speech-large/gen_products/191_abc123_d618db1d HTTP/1.1
            Host: noiz.ai
            Authorization: YOUR_API_KEY
      responses:
        '200':
          description: Job status and result
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 0
                  message:
                    type: string
                    example: success
                  data:
                    type: object
                    properties:
                      gen_product_id:
                        type: string
                      status:
                        type: string
                        description: "Job status: PENDING | RUNNING | COMPLETED | STOPPED | FAILED"
                        example: COMPLETED
                      url:
                        type: string
                        description: Signed URL for the merged audio file (valid 7 days). Empty if not yet completed.
                        example: "https://storage.googleapis.com/..."
                      file_path:
                        type: string
                        description: GCS path of the merged audio file
                      duration:
                        type: integer
                        description: Total audio duration in milliseconds
                        example: 92892
                      target_text:
                        type: string
                        description: Full input text
                      sections:
                        type: array
                        description: Individual audio segments
                        items:
                          type: object
                          properties:
                            section_id:
                              type: string
                            section_text:
                              type: string
                            voice_id:
                              type: string
                            url:
                              type: string
                              description: Signed URL for this segment (valid 7 days)
                            duration:
                              type: integer
                            section_status:
                              type: string
                              description: "PENDING | COMPLETED | FAILED"
                      message:
                        type: string
                        description: Error message if job failed
          x-gitbook-description-html: <p>Job status and result</p>
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          description: Job not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 404
                message: job not found
          x-gitbook-description-html: <p>Job not found</p>
      x-gitbook-description-html: >-
        <p>Poll the status and result of a long-form TTS job. When status is
        COMPLETED, download URLs are available for each segment and the merged
        audio file.</p>
  /emotion-enhance:
    post:
      operationId: emotionEnhance
      tags:
        - Text to Speech
      summary: Emotion enhancement
      description: >-
        Automatically add emotion annotations to input text. The enhanced text 
        can be used directly in the text-to-speech API for more expressive
        speech synthesis.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - text
              properties:
                text:
                  type: string
                  description: Text to enhance with emotions (max 5000 chars)
                  x-gitbook-description-html: <p>Text to enhance with emotions (max 5000 chars)</p>
      x-codeSamples:
        - lang: http
          label: HTTP
          source: |
            POST /v1/emotion-enhance HTTP/1.1
            Host: noiz.ai
            Authorization: YOUR_API_KEY
            Content-Type: application/json
            Accept: */*

            {
              "text": "Hello, how are you today? I'm so excited to see you!"
            }
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    description: Status code (0 = success)
                    x-gitbook-description-html: <p>Status code (0 = success)</p>
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      emotion_enhance:
                        type: string
                        description: Text with emotion annotations added
                        x-gitbook-description-html: <p>Text with emotion annotations added</p>
              example:
                code: 0
                message: success
                data:
                  emotion_enhance: >-
                    [Happy#Joy:0.8;Excitement:0.2]:Hello, how are you today? I'm
                    so excited to see you!
          x-gitbook-description-html: <p>Success</p>
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              examples:
                text_empty:
                  summary: Text is empty
                  value:
                    code: 400
                    message: text is required
                text_too_long:
                  summary: Text exceeds max length
                  value:
                    code: 400
                    message: text exceeds max length
                user_blocked:
                  summary: User is blocked
                  value:
                    code: 400
                    message: user blocked
                user_pending:
                  summary: User pending verification
                  value:
                    code: 400
                    message: user pending verification
          x-gitbook-description-html: <p>Invalid request</p>
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          description: Payment required
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 402
                message: API usage not allowed - insufficient credits
          x-gitbook-description-html: <p>Payment required</p>
        '429':
          description: Hard limit exceeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 429
                message: Monthly usage limit exceeded
          x-gitbook-description-html: <p>Hard limit exceeded</p>
      x-gitbook-description-html: >-
        <p>Automatically add emotion annotations to input text. The enhanced
        text can be used directly in the text-to-speech API for more expressive
        speech synthesis.</p>
      x-gitbook-description-document:
        object: document
        data:
          schemaVersion: 9
        nodes:
          - object: block
            type: paragraph
            isVoid: false
            data: {}
            nodes:
              - object: text
                leaves:
                  - object: leaf
                    text: >-
                      Automatically add emotion annotations to input text. The
                      enhanced text can be used directly in the text-to-speech
                      API for more expressive speech synthesis.
                    marks: []
                key: Rk50aDRN9jTD
            key: wI3nleF4PoOP
        key: q6fj8otffTSE
  /guest/text-to-speech:
    post:
      operationId: guestTextToSpeech
      tags:
        - Guest
      summary: Guest text-to-speech (no login required)
      description: >-
        Text-to-speech for unauthenticated users. Rate-limited by IP address.
        Only whitelisted built-in voices are available. Text is limited to 400
        characters. Each IP is limited to 5 requests per month.
      security: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - text
              properties:
                text:
                  type: string
                  maxLength: 400
                  description: Text to convert to speech (max 400 characters)
                  x-gitbook-description-html: <p>Text to convert to speech (max 400 characters)</p>
                voice_id:
                  type: string
                  description: >-
                    Voice ID (must be from the guest whitelist). Optional — if
                    omitted, a default voice is assigned based on target_lang
                    (en: 95814add, zh: 3b9f1e27, ja: 063a4491). Available
                    voices — en: 95814add, 5a68d66b, a845c7de, 883b6b7c,
                    0e4ab6ec; zh: 3b9f1e27, b4775100, ac09aeb4, 87cb2405,
                    77e15f2c; ja: 063a4491, 4252b9c8, 578b4be2, f00e45a1,
                    a9249ce7.
                  x-gitbook-description-html: >-
                    <p>Voice ID (must be from the guest whitelist). Optional — if
                    omitted, a default voice is assigned based on target_lang
                    (en: 95814add, zh: 3b9f1e27, ja: 063a4491). Available
                    voices — en: 95814add, 5a68d66b, a845c7de, 883b6b7c,
                    0e4ab6ec; zh: 3b9f1e27, b4775100, ac09aeb4, 87cb2405,
                    77e15f2c; ja: 063a4491, 4252b9c8, 578b4be2, f00e45a1,
                    a9249ce7.</p>
                output_format:
                  type: string
                  enum:
                    - wav
                    - mp3
                  default: wav
                  description: Output audio format
                  x-gitbook-description-html: <p>Output audio format</p>
                target_lang:
                  type: string
                  description: Target language code (e.g., "zh", "en", "ja")
                  x-gitbook-description-html: <p>Target language code (e.g., "zh", "en", "ja")</p>
                speed:
                  type: number
                  minimum: 0.5
                  maximum: 2
                  default: 1
                  description: Speech speed multiplier (0.5–2.0)
                  x-gitbook-description-html: <p>Speech speed multiplier (0.5–2.0)</p>
                filter_type:
                  type: string
                  enum:
                    - telephone
                    - radio
                    - hall
                    - studio
                  description: Optional audio filter effect
                  x-gitbook-description-html: <p>Optional audio filter effect</p>
      x-codeSamples:
        - lang: http
          label: HTTP
          source: |
            POST /v1/guest/text-to-speech HTTP/1.1
            Host: noiz.ai
            Content-Type: multipart/form-data

            text=Every great story satisfies some kind of hunger, and ours is just getting started.
        - lang: curl
          label: cURL (minimal — uses default voice)
          source: |
            curl -X POST https://noiz.ai/v1/guest/text-to-speech \
              -F "text=Every great story satisfies some kind of hunger, and ours is just getting started." \
              -F "output_format=mp3" \
              --output output.mp3
        - lang: curl
          label: cURL (with voice_id)
          source: |
            curl -X POST https://noiz.ai/v1/guest/text-to-speech \
              -F "text=Every great story satisfies some kind of hunger, and ours is just getting started." \
              -F "voice_id=95814add" \
              -F "output_format=mp3" \
              --output output.mp3
      responses:
        '200':
          description: Success — returns audio binary stream
          content:
            audio/wav:
              schema:
                type: string
                format: binary
            audio/mpeg:
              schema:
                type: string
                format: binary
          x-gitbook-description-html: <p>Success — returns audio binary stream</p>
        '400':
          description: Invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              examples:
                text_empty:
                  summary: Text is empty
                  value:
                    code: 400
                    message: text is required
                text_too_long:
                  summary: Text exceeds 400 characters
                  value:
                    code: 400
                    message: text exceeds max length
                voice_not_allowed:
                  summary: Voice ID not in whitelist
                  value:
                    code: 400
                    message: voice not found
                invalid_format:
                  summary: Unsupported output format
                  value:
                    code: 400
                    message: invalid parameters
                sensitive_word:
                  summary: Text contains sensitive content
                  value:
                    code: 400
                    message: text contains sensitive word
          x-gitbook-description-html: <p>Invalid parameters</p>
        '429':
          description: Rate limit or monthly quota exceeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      ttl:
                        type: integer
                        description: Seconds to wait before retrying
                        x-gitbook-description-html: <p>Seconds to wait before retrying</p>
              examples:
                rate_limit:
                  summary: Per-minute rate limit exceeded
                  value:
                    code: 429
                    message: Rate limit exceeded, please try again later
                    data:
                      ttl: 45
                monthly_quota:
                  summary: Monthly quota exhausted
                  value:
                    code: 429
                    message: Monthly quota exceeded
                    data:
                      ttl: 0
                duplicate_request:
                  summary: Duplicate request in progress
                  value:
                    code: 429
                    message: Duplicate request in progress, please wait.
          x-gitbook-description-html: <p>Rate limit or monthly quota exceeded</p>
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 500
                message: TTS inference failed
          x-gitbook-description-html: <p>Internal server error</p>
        '503':
          description: Service busy
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 503
                message: Service busy, please try again later.
          x-gitbook-description-html: <p>Service busy</p>
        '504':
          description: Inference timeout
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 504
                message: TTS inference timed out, please try again.
          x-gitbook-description-html: <p>Inference timeout</p>
      x-gitbook-description-html: >-
        <p>Text-to-speech for unauthenticated users. Rate-limited by IP address.
        Only whitelisted built-in voices are available. Text is limited to 400
        characters. Each IP is limited to 5 requests per month.</p>
      x-gitbook-description-document:
        object: document
        data:
          schemaVersion: 9
        nodes:
          - object: block
            type: paragraph
            isVoid: false
            data: {}
            nodes:
              - object: text
                leaves:
                  - object: leaf
                    text: >-
                      Text-to-speech for unauthenticated users. Rate-limited by
                      IP address. Only whitelisted built-in voices are
                      available. Text is limited to 400 characters. Each IP is
                      limited to 5 requests per month.
                    marks: []
                key: ia10rRe8jXFs
            key: 4e6B2qMlRfXk
        key: zoCrqR82yNlC
  /voice-design:
    post:
      operationId: voiceDesign
      tags:
        - Voice Design
      summary: Design a voice
      description: >-
        Analyze input (text description and/or image) to design a voice, 
        returning similar voice samples or generating new ones via AI.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                picture:
                  type: string
                  format: binary
                  description: Optional image file to analyze for voice design
                  x-gitbook-description-html: <p>Optional image file to analyze for voice design</p>
                voice_description:
                  type: string
                  maxLength: 1000
                  description: Description of the desired voice (20-1000 characters)
                  x-gitbook-description-html: <p>Description of the desired voice (20-1000 characters)</p>
                guidance_scale:
                  type: number
                  minimum: 0
                  maximum: 100
                  default: 5
                  description: Guidance scale for voice generation (0-100)
                  x-gitbook-description-html: <p>Guidance scale for voice generation (0-100)</p>
                loudness:
                  type: number
                  minimum: -1
                  maximum: 1
                  default: 0.5
                  description: Loudness level (-1 to 1)
                  x-gitbook-description-html: <p>Loudness level (-1 to 1)</p>
      x-codeSamples:
        - lang: http
          label: HTTP - With description
          source: >
            POST /v1/voice-design HTTP/1.1

            Host: noiz.ai

            Authorization: YOUR_API_KEY

            Content-Type: multipart/form-data

            Accept: */*


            voice_description=A warm, friendly female voice with a slight
            British accent
        - lang: http
          label: HTTP - With image
          source: |
            POST /v1/voice-design HTTP/1.1
            Host: noiz.ai
            Authorization: YOUR_API_KEY
            Content-Type: multipart/form-data
            Accept: */*

            picture=@character.png
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    description: Status code (0 = success)
                    x-gitbook-description-html: <p>Status code (0 = success)</p>
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      previews:
                        type: array
                        description: List of voice preview samples
                        x-gitbook-description-html: <p>List of voice preview samples</p>
                        items:
                          type: object
                          properties:
                            voice_id:
                              type: string
                              description: Voice ID for this preview
                              x-gitbook-description-html: <p>Voice ID for this preview</p>
                            audio:
                              type: string
                              description: Base64 encoded audio data
                              x-gitbook-description-html: <p>Base64 encoded audio data</p>
                      text:
                        type: string
                        description: Sample text used for the voice preview
                        x-gitbook-description-html: <p>Sample text used for the voice preview</p>
                      from_cache:
                        type: boolean
                        description: Whether the result was retrieved from cache
                        x-gitbook-description-html: <p>Whether the result was retrieved from cache</p>
                      features:
                        type: object
                        description: Voice features extracted from analysis
                        x-gitbook-description-html: <p>Voice features extracted from analysis</p>
                        properties:
                          gender:
                            type: string
                            description: Detected/specified gender
                            x-gitbook-description-html: <p>Detected/specified gender</p>
                          age:
                            type: string
                            description: Detected/specified age range
                            x-gitbook-description-html: <p>Detected/specified age range</p>
                          language:
                            type: string
                            description: Language code
                            x-gitbook-description-html: <p>Language code</p>
                          voice_prompt:
                            type: string
                            description: Generated voice prompt
                            x-gitbook-description-html: <p>Generated voice prompt</p>
                          display_name:
                            type: string
                            description: Suggested display name for the voice
                            x-gitbook-description-html: <p>Suggested display name for the voice</p>
              example:
                code: 0
                message: success
                data:
                  previews:
                    - voice_id: abc123
                      audio: UklGRiQA...
                  text: Hello, this is a sample of my voice.
                  from_cache: false
                  features:
                    gender: female
                    age: adult
                    language: en
                    voice_prompt: A warm, friendly female voice
                    display_name: Friendly Female
          x-gitbook-description-html: <p>Success</p>
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              examples:
                missing_input:
                  summary: Neither description nor picture provided
                  value:
                    code: 400
                    message: >-
                      At least one of voice_description or picture must be
                      provided
                user_pending:
                  summary: User pending verification
                  value:
                    code: 400
                    message: user pending verification
                monthly_limit:
                  summary: Monthly design limit exceeded
                  value:
                    code: 400
                    message: Too many voice designs this month
          x-gitbook-description-html: <p>Invalid request</p>
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          description: Payment required
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 402
                message: API usage not allowed - insufficient credits
          x-gitbook-description-html: <p>Payment required</p>
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              examples:
                gemini_failed:
                  summary: Gemini analysis failed
                  value:
                    code: 500
                    message: Failed to analyze voice requirements with Gemini
                elevenlabs_not_configured:
                  summary: ElevenLabs not configured
                  value:
                    code: 500
                    message: ElevenLabs client not configured
          x-gitbook-description-html: <p>Internal server error</p>
      x-gitbook-description-html: >-
        <p>Analyze input (text description and/or image) to design a voice,
        returning similar voice samples or generating new ones via AI.</p>
      x-gitbook-description-document:
        object: document
        data:
          schemaVersion: 9
        nodes:
          - object: block
            type: paragraph
            isVoid: false
            data: {}
            nodes:
              - object: text
                leaves:
                  - object: leaf
                    text: >-
                      Analyze input (text description and/or image) to design a
                      voice, returning similar voice samples or generating new
                      ones via AI.
                    marks: []
                key: W3zWaSoR3vLq
            key: YthD8ACoTJ7v
        key: wvb0Iqgh9HoV
  /text-to-sound:
    post:
      operationId: textToSound
      tags:
        - Text to Sound
      summary: Generate sound from text
      description: >-
        Generate sound effects or music from a text prompt using AI.
        Returns the audio file bytes directly (not a URL). Billed at $0.015/second; each call's duration is rounded up to whole seconds (minimum 1 second).
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - prompt
              properties:
                prompt:
                  type: string
                  maxLength: 500
                  description: Text description of the sound to generate (max 500 chars)
                  x-gitbook-description-html: <p>Text description of the sound to generate (max 500 chars)</p>
                duration:
                  type: number
                  minimum: 1
                  maximum: 30
                  default: 10
                  description: Duration of the generated audio in seconds (1-30)
                  x-gitbook-description-html: <p>Duration of the generated audio in seconds (1-30)</p>
                output_format:
                  type: string
                  enum:
                    - wav
                    - mp3
                  default: wav
                  description: Output audio format
                  x-gitbook-description-html: <p>Output audio format (wav/mp3)</p>
      x-codeSamples:
        - lang: http
          label: HTTP
          source: |
            POST /v1/text-to-sound HTTP/1.1
            Host: noiz.ai
            Authorization: YOUR_API_KEY
            Content-Type: multipart/form-data

            prompt=ocean waves crashing on rocky shore&duration=10&output_format=wav
        - lang: curl
          label: CURL
          source: |
            curl -X POST https://noiz.ai/v1/text-to-sound \
              -H "Authorization: YOUR_API_KEY" \
              -F "prompt=ocean waves crashing on rocky shore" \
              -F "duration=10" \
              -F "output_format=wav" \
              --output output.wav
      responses:
        '200':
          description: Audio file bytes (wav or mp3)
          content:
            audio/wav:
              schema:
                type: string
                format: binary
            audio/mpeg:
              schema:
                type: string
                format: binary
          x-gitbook-description-html: <p>Audio file bytes returned directly. Save to a .wav or .mp3 file.</p>
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          description: Insufficient credits
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 402
                message: API usage not allowed - insufficient credits
          x-gitbook-description-html: <p>Insufficient credits</p>
        '429':
          description: Rate limit exceeded (5 requests per 60 seconds)
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 429
                message: Rate limit exceeded
          x-gitbook-description-html: <p>Rate limit exceeded</p>
      x-gitbook-description-html: >-
        <p>Generate sound effects or music from a text prompt using AI.
        Returns the audio file bytes directly (not a URL). Billed at $0.015/second; each call's duration is rounded up to whole seconds (minimum 1 second).</p>
  /text-to-sound-history:
    get:
      operationId: textToSoundHistory
      tags:
        - Text to Sound
      summary: Get text-to-sound generation history
      description: Returns a paginated list of past text-to-sound generation results.
      parameters:
        - name: skip
          in: query
          schema:
            type: integer
            default: 0
          description: Number of records to skip
          x-gitbook-description-html: <p>Number of records to skip</p>
        - name: limit
          in: query
          schema:
            type: integer
            default: 20
          description: Maximum number of records to return
          x-gitbook-description-html: <p>Maximum number of records to return</p>
      responses:
        '200':
          description: History retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 200
                  data:
                    type: object
                    properties:
                      list:
                        type: array
                        items:
                          type: object
                          properties:
                            gen_product_id:
                              type: string
                            prompt:
                              type: string
                            duration:
                              type: number
                              nullable: true
                            file_url:
                              type: string
                              nullable: true
                            create_time:
                              type: string
                              nullable: true
                      skip:
                        type: integer
                      limit:
                        type: integer
        '401':
          $ref: '#/components/responses/UnauthorizedError'
      x-gitbook-description-html: <p>Returns a paginated list of past text-to-sound generation results.</p>
  /text-to-sound-history/{gen_product_id}:
    delete:
      operationId: deleteTextToSoundHistory
      tags:
        - Text to Sound
      summary: Delete a text-to-sound history record
      description: Deletes a specific generation result from history by its ID.
      parameters:
        - name: gen_product_id
          in: path
          required: true
          schema:
            type: string
          description: The generation product ID to delete
          x-gitbook-description-html: <p>The generation product ID to delete</p>
      responses:
        '200':
          description: Record deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 200
                  data:
                    type: object
                    properties:
                      gen_product_id:
                        type: string
        '401':
          $ref: '#/components/responses/UnauthorizedError'
      x-gitbook-description-html: <p>Deletes a specific generation result from history by its ID.</p>
  /text-to-music:
    post:
      operationId: createTextToMusic
      tags:
        - Text to Music
      summary: Submit a text-to-music generation job (async)
      description: >-
        Submit an async music generation job from a text prompt plus
        either `lyrics` or `lyrics_prompt`. Returns 2 variants — poll each
        `gen_product_id` with GET. Billed once per job at
        `ceil(longest variant seconds) × 15` credits, or $0.00015/second
        on PAYGO. Rate limited to 5 requests / 60 seconds.
      requestBody:
        required: false
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                instrumental:
                  type: boolean
                  default: false
                  description: >-
                    YuE2 does not support instrumental=true (request is
                    rejected). Leave false.
                  x-gitbook-description-html: <p>YuE2 does not support instrumental=true (request is rejected). Leave false.</p>
                prompt:
                  type: string
                  description: Required. Free-form description of the song (used as YuE2 style)
                  x-gitbook-description-html: <p>Required. Free-form description of the song (used as YuE2 style)</p>
                lyrics:
                  type: string
                  description: Custom lyrics to use as-is (required unless lyrics_prompt is set)
                  x-gitbook-description-html: <p>Custom lyrics to use as-is (required unless lyrics_prompt is set)</p>
                lyrics_prompt:
                  type: string
                  description: Prompt to auto-generate lyrics from (mutually exclusive with lyrics)
                  x-gitbook-description-html: <p>Prompt to auto-generate lyrics from (mutually exclusive with lyrics)</p>
                lyrics_file:
                  type: string
                  format: binary
                  description: Lyrics as a UTF-8 .txt file (max 64KB)
                  x-gitbook-description-html: <p>Lyrics as a UTF-8 .txt file (max 64KB)</p>
                  x-example-filename: lyrics.txt
                abc:
                  type: string
                  maxLength: 64000
                  description: >-
                    Full ABC music score as text (non-blank, max 64,000
                    characters). Passed to YuE2 as-is — it is not regenerated
                    or rewritten. Send it as a text form field (for example
                    curl `-F "abc=<score.abc"`), not as a file upload. Cannot
                    be combined with `cot=off`.
                  x-gitbook-description-html: <p>Full ABC music score as text (non-blank, max 64,000 characters). Passed to YuE2 as-is — it is not regenerated or rewritten. Send it as a text form field (for example curl <code>-F "abc=&lt;score.abc"</code>), not as a file upload. Cannot be combined with <code>cot=off</code>.</p>
                cot:
                  type: string
                  enum: [full, melody, "off"]
                  description: >-
                    Score-planning mode. Defaults to `full` when `abc` is
                    sent, otherwise `off`. `off` cannot be used together with
                    `abc`.
                  x-gitbook-description-html: <p>Score-planning mode. Defaults to <code>full</code> when <code>abc</code> is sent, otherwise <code>off</code>. <code>off</code> cannot be used together with <code>abc</code>.</p>
                title:
                  type: string
                  description: Song title
                  x-gitbook-description-html: <p>Song title</p>
                tags:
                  type: string
                  description: Comma-separated style tags
                  x-gitbook-description-html: <p>Comma-separated style tags</p>
                negative_tags:
                  type: string
                  description: Comma-separated style tags to avoid
                  x-gitbook-description-html: <p>Comma-separated style tags to avoid</p>
                vocal_gender:
                  type: string
                  enum: [Male, Female]
                  description: Preferred vocal gender
                  x-gitbook-description-html: <p>Preferred vocal gender</p>
                mv:
                  type: string
                  deprecated: true
                  description: >-
                    Ignored on YuE2. Accepted for compatibility; not forwarded
                    to the generator.
                  x-gitbook-description-html: <p>Ignored on YuE2. Accepted for compatibility; not forwarded to the generator.</p>
                auto_lyrics:
                  type: boolean
                  default: false
                  deprecated: true
                  description: >-
                    Ignored on YuE2. Use lyrics_prompt to auto-write lyrics
                    instead.
                  x-gitbook-description-html: <p>Ignored on YuE2. Use lyrics_prompt to auto-write lyrics instead.</p>
                target_duration:
                  type: integer
                  enum: [60, 120, 180]
                  deprecated: true
                  description: >-
                    Ignored on YuE2 (does not control length). If sent, must
                    still be 60/120/180 or the request is rejected. Omit it —
                    the pre-flight credit check then assumes 180 s
                    (2700 credits).
                  x-gitbook-description-html: <p>Ignored on YuE2 (does not control length). If sent, must still be 60/120/180 or the request is rejected. Omit it — the pre-flight credit check then assumes 180 s (2700 credits).</p>
                reference_audio_url:
                  type: string
                  deprecated: true
                  description: >-
                    Ignored on YuE2. Accepted for compatibility; not forwarded
                    to the generator.
                  x-gitbook-description-html: <p>Ignored on YuE2. Accepted for compatibility; not forwarded to the generator.</p>
                reference_audio_file:
                  type: string
                  format: binary
                  deprecated: true
                  description: >-
                    Ignored on YuE2. Accepted for compatibility; not forwarded
                    to the generator.
                  x-gitbook-description-html: <p>Ignored on YuE2. Accepted for compatibility; not forwarded to the generator.</p>
                lyric_timestamps:
                  type: boolean
                  default: false
                  description: >-
                    Return per-line lyric timestamps once the job succeeds.
                    Ignored when instrumental=true (no lyrics to align).
                  x-gitbook-description-html: <p>Return per-line lyric timestamps once the job succeeds. Ignored when instrumental=true (no lyrics to align).</p>
      x-codeSamples:
        - lang: curl
          label: CURL
          source: |
            curl -X POST https://noiz.ai/v1/text-to-music \
              -H "Authorization: YOUR_API_KEY" \
              -F "prompt=an upbeat synthwave track about driving at night" \
              -F "lyrics_prompt=neon highway, late night, analog synths"
      responses:
        '200':
          description: Job submitted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 0
                  message:
                    type: string
                    example: success
                  data:
                    type: object
                    properties:
                      results:
                        type: array
                        description: One entry per variant (always 2)
                        items:
                          type: object
                          properties:
                            gen_product_id:
                              type: string
                            status:
                              type: string
                              example: submitted
                      errors:
                        type: array
                        items:
                          type: object
                      pricing:
                        type: object
                        properties:
                          credits_per_second:
                            type: integer
                            example: 15
                          usd_per_second:
                            type: number
                            example: 0.00015
                          note:
                            type: string
              example:
                code: 0
                message: success
                data:
                  results:
                    - gen_product_id: 3f9a...tm_v1_tm
                      status: submitted
                    - gen_product_id: 3f9a...tm_v2_tm
                      status: submitted
                  errors: []
                  pricing:
                    credits_per_second: 15
                    usd_per_second: 0.00015
                    note: >-
                      Prefer subscription credits: ceil(max variant
                      duration)×15. If balance cannot cover the whole job,
                      PAYGO at ~$0.00015/s; no half-credit mix.
          x-gitbook-description-html: <p>Job submitted successfully. Two gen_product_id values are returned (one per variant) — poll each with GET /v1/text-to-music/{gen_product_id}.</p>
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          description: >-
            Insufficient credits and no payment method on file (or monthly
            hard limit reached). The pre-flight check sizes the job from
            `target_duration`; omitting it assumes 180 s, so the account
            needs 2700 credits, a payment method, or `invoice` billing.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 402
                message: "Insufficient credits. Please add a payment method to continue: https://developers.noiz.ai/billing-payment-methods"
          x-gitbook-description-html: <p>Insufficient credits and no payment method on file, or the account's monthly hard limit has been reached.</p>
        '429':
          description: Rate limit exceeded (5 requests per 60 seconds)
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 429
                message: Rate limit exceeded
          x-gitbook-description-html: <p>Rate limit exceeded</p>
        '503':
          description: Music generation service temporarily unavailable
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
          x-gitbook-description-html: <p>Music generation service temporarily unavailable</p>
      x-gitbook-description-html: >-
        <p>Submit an async music generation job from a text prompt plus
        either lyrics or lyrics_prompt. Returns 2 variants — poll each
        gen_product_id with GET. Billed once per job at ceil(longest
        variant seconds)×15 credits, or $0.00015/second on PAYGO.</p>
  /text-to-music/{gen_product_id}:
    get:
      operationId: getTextToMusic
      tags:
        - Text to Music
      summary: Query a text-to-music job's status
      description: >-
        Poll for a single variant's status by its gen_product_id (one of the
        two IDs returned by POST /v1/text-to-music). Billing settles once
        both variants have succeeded — the longer of the 2 determines
        `effective_duration` and `credit_cost`; if either fails, nothing is
        charged.
        Rate limited to 60 requests / 60 seconds.
      parameters:
        - name: gen_product_id
          in: path
          required: true
          schema:
            type: string
          description: The gen_product_id to query
          x-gitbook-description-html: <p>The gen_product_id to query</p>
      responses:
        '200':
          description: Status retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 0
                  message:
                    type: string
                    example: success
                  data:
                    type: object
                    description: >-
                      Trimmed to only the fields Developer API callers actually
                      need — Studio-only fields (preview-lock state, like/favorite
                      status, submitted request echoes) are filtered out server-side.
                    properties:
                      gen_product_id:
                        type: string
                      status:
                        type: string
                        enum: [submitted, running, succeeded, failed]
                      progress:
                        type: string
                        nullable: true
                      batch_id:
                        type: string
                        description: Shared by both variants from the same submission
                      variant_index:
                        type: integer
                      title:
                        type: string
                        nullable: true
                        description: >-
                          Echoed if you submitted one; otherwise the
                          auto-generated title.
                      lyrics_generated:
                        type: string
                        nullable: true
                        description: >-
                          The final lyrics used for this variant — either your
                          submitted lyrics/lyrics_file, or auto-written lyrics
                          if you used lyrics_prompt.
                      duration:
                        type: number
                        nullable: true
                        description: This variant's own duration in seconds
                      audio_url:
                        type: string
                        nullable: true
                        description: Signed download URL, present once succeeded
                      image_url_remote:
                        type: string
                        nullable: true
                      create_time:
                        type: string
                      error_message:
                        type: string
                        nullable: true
                      credit_cost:
                        type: integer
                        nullable: true
                        description: Set once billing has settled (ceil(effective_duration)×15)
                      effective_duration:
                        type: integer
                        nullable: true
                        description: The longer of the 2 variants' durations — used for billing
                      credit_charged:
                        type: boolean
                        description: True if this job was paid from subscription credits
                      api_billing:
                        type: string
                        nullable: true
                        enum: [credits, paygo]
                        description: Which path this job settled on, once settled
                      lyric_timings:
                        type: array
                        nullable: true
                        description: >-
                          Per-line lyric timestamps, present once succeeded —
                          only if the job was submitted with
                          lyric_timestamps=true. Null if that flag was omitted,
                          or if alignment failed (see lyric_timings_error).
                        items:
                          type: object
                          properties:
                            text:
                              type: string
                            start:
                              type: number
                              description: Line start time in seconds
                            end:
                              type: number
                              description: Line end time in seconds
                      lyric_timings_engine:
                        type: string
                        nullable: true
                        enum: [mms, whisper]
                        description: Which engine produced lyric_timings, set only on success
                      lyric_timings_error:
                        type: object
                        nullable: true
                        description: Set only if lyric_timestamps=true and alignment failed
                        properties:
                          code:
                            type: string
                            enum: [alignment_failed, aligner_unavailable]
                          message:
                            type: string
              example:
                code: 0
                message: success
                data:
                  gen_product_id: 3f9a...tm_v1_tm
                  status: succeeded
                  progress: "100%"
                  batch_id: 8e21...
                  variant_index: 0
                  title: Paper Moon Loop
                  duration: 59
                  audio_url: https://storage.googleapis.com/...
                  credit_cost: 1050
                  effective_duration: 70
                  credit_charged: true
                  api_billing: credits
                  lyric_timings:
                    - text: Morning light across the hill
                      start: 12.1
                      end: 14.54
                    - text: The river hums and time stands still
                      start: 17.48
                      end: 20.38
                  lyric_timings_engine: mms
                  lyric_timings_error: null
          x-gitbook-description-html: <p>Status retrieved successfully. Poll until status is succeeded or failed.</p>
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          description: Record not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 404
                message: Record not found
          x-gitbook-description-html: <p>Record not found</p>
      x-gitbook-description-html: >-
        <p>Poll for a single variant's status by its gen_product_id. Billing
        settles the first time a variant is observed as succeeded.</p>
  /text-to-music/cover/recognize-lyrics:
    post:
      operationId: recognizeTextToMusicCoverLyrics
      tags:
        - Text to Music
      summary: Recognize lyrics from a cover source track (sync)
      description: >-
        Transcribe lyrics from a source audio track before submitting a YuE2
        cover. Provide one of `source_audio_file`, `source_audio_url`, or an
        already-owned `source_file_path` (`noiz_raw_{user_id}_*`). Charged
        only when vocals are detected: 100 subscription credits first,
        otherwise PAYGO $0.001 (same credit-to-USD rate as text-to-music).
        No vocals means no charge. Rate limited to 5 requests / 60 seconds.
      requestBody:
        required: false
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                source_audio_file:
                  type: string
                  format: binary
                  description: Source audio (mp3/wav/flac/m4a/aac/ogg, max 100MB)
                  x-gitbook-description-html: <p>Source audio (mp3/wav/flac/m4a/aac/ogg, max 100MB)</p>
                source_audio_url:
                  type: string
                  description: Public http(s) URL of the source audio
                  x-gitbook-description-html: <p>Public http(s) URL of the source audio</p>
                source_file_path:
                  type: string
                  description: >-
                    Already-owned SpeechService blob name
                    (`noiz_raw_{user_id}_*`)
                  x-gitbook-description-html: <p>Already-owned SpeechService blob name (<code>noiz_raw_{user_id}_*</code>)</p>
                source_mime_type:
                  type: string
                  description: MIME type hint when the filename/URL has no extension
                  x-gitbook-description-html: <p>MIME type hint when the filename/URL has no extension</p>
                idempotency_key:
                  type: string
                  description: Optional key (max 128 chars) to deduplicate recognition
                  x-gitbook-description-html: <p>Optional key (max 128 chars) to deduplicate recognition</p>
      x-codeSamples:
        - lang: curl
          label: CURL
          source: |
            curl -X POST https://noiz.ai/v1/text-to-music/cover/recognize-lyrics \
              -H "Authorization: YOUR_API_KEY" \
              -F "source_audio_file=@song.mp3"
      responses:
        '200':
          description: Recognition finished
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 0
                  message:
                    type: string
                    example: success
                  data:
                    type: object
                    properties:
                      has_vocals:
                        type: boolean
                      lyrics:
                        type: string
                      sections:
                        type: array
                        items:
                          type: object
                      credit_cost:
                        type: integer
                      charged:
                        type: boolean
                      api_billing:
                        type: string
                        enum: [credits, paygo]
                      credit_charged:
                        type: boolean
              example:
                code: 0
                message: success
                data:
                  has_vocals: true
                  lyrics: "[Verse 1]\n..."
                  credit_cost: 100
                  charged: true
                  api_billing: credits
                  credit_charged: true
          x-gitbook-description-html: "<p>Recognition finished. Vocals: 100 credits or PAYGO $0.001. No vocals: no charge.</p>"
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          description: Insufficient credits and no payment method / usage limit exceeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 402
                message: Insufficient credits. Please add a payment method to continue
      x-gitbook-description-html: "<p>Recognize lyrics from a source track. Vocals: 100 credits first, otherwise PAYGO $0.001. No vocals: no charge.</p>"
  /text-to-music/cover:
    post:
      operationId: createTextToMusicCover
      tags:
        - Text to Music
      summary: Submit a YuE2 cover generation job (async)
      description: >-
        Cover an existing track with YuE2: supply source audio (file, URL,
        or an already-owned `source_file_path`) plus `lyrics` and
        `melody_adherence`. Returns 2 variants — poll
        `GET /v1/text-to-music/cover/{task_id}`. Same billing as
        text-to-music; monthly free quota and daily preview are not
        available on the API. Rate limited to 5 requests / 60 seconds.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - lyrics
                - melody_adherence
              properties:
                source_audio_file:
                  type: string
                  format: binary
                  description: Source audio (mp3/wav/flac/m4a/aac/ogg, max 100MB)
                  x-gitbook-description-html: <p>Source audio (mp3/wav/flac/m4a/aac/ogg, max 100MB)</p>
                source_audio_url:
                  type: string
                  description: Public http(s) URL of the source audio
                  x-gitbook-description-html: <p>Public http(s) URL of the source audio</p>
                source_file_path:
                  type: string
                  description: >-
                    Already-owned SpeechService blob name
                    (`noiz_raw_{user_id}_*`)
                  x-gitbook-description-html: <p>Already-owned SpeechService blob name (<code>noiz_raw_{user_id}_*</code>)</p>
                source_mime_type:
                  type: string
                  description: MIME type hint when the filename/URL has no extension
                  x-gitbook-description-html: <p>MIME type hint when the filename/URL has no extension</p>
                lyrics:
                  type: string
                  description: Required. Lyrics to sing over the source melody
                  x-gitbook-description-html: <p>Required. Lyrics to sing over the source melody</p>
                music_description:
                  type: string
                  description: Free-form description of the cover (required if style is empty)
                  x-gitbook-description-html: <p>Free-form description of the cover (required if style is empty)</p>
                style:
                  type: string
                  description: Style tags (required if music_description is empty)
                  x-gitbook-description-html: <p>Style tags (required if music_description is empty)</p>
                melody_adherence:
                  type: string
                  enum: [high, main_melody]
                  description: >-
                    high = full score (cot=full); main_melody = melody-only
                    (cot=melody)
                  x-gitbook-description-html: <p>high = full score (cot=full); main_melody = melody-only (cot=melody)</p>
                title:
                  type: string
                  description: Optional title; auto-generated if omitted
                  x-gitbook-description-html: <p>Optional title; auto-generated if omitted</p>
                vocal_gender:
                  type: string
                  enum: [Male, Female]
                  description: Preferred vocal gender
                  x-gitbook-description-html: <p>Preferred vocal gender</p>
                lyric_timestamps:
                  type: boolean
                  default: false
                  description: Return per-line lyric timestamps once the job succeeds.
                  x-gitbook-description-html: <p>Return per-line lyric timestamps once the job succeeds.</p>
      x-codeSamples:
        - lang: curl
          label: CURL
          source: |
            curl -X POST https://noiz.ai/v1/text-to-music/cover \
              -H "Authorization: YOUR_API_KEY" \
              -F "source_audio_file=@song.mp3" \
              -F "lyrics=[Verse 1]\nnew words for the melody" \
              -F "music_description=keep the original vocal character" \
              -F "melody_adherence=main_melody"
      responses:
        '200':
          description: Cover job submitted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 0
                  message:
                    type: string
                    example: success
                  data:
                    type: object
                    properties:
                      task_id:
                        type: string
                      status:
                        type: string
                        example: submitted
                      stage:
                        type: string
                        example: score_pending
                      results:
                        type: array
                        description: One entry per variant (always 2)
                        items:
                          type: object
                          properties:
                            gen_product_id:
                              type: string
                            status:
                              type: string
                              example: submitted
                      pricing:
                        type: object
                        properties:
                          credits_per_second:
                            type: integer
                            example: 15
                          usd_per_second:
                            type: number
                            example: 0.00015
                          note:
                            type: string
              example:
                code: 0
                message: success
                data:
                  task_id: 8e21...
                  status: submitted
                  stage: score_pending
                  results:
                    - gen_product_id: 3f9a...cm_v1_cm
                      status: submitted
                    - gen_product_id: 3f9a...cm_v2_cm
                      status: submitted
                  pricing:
                    credits_per_second: 15
                    usd_per_second: 0.00015
                    note: >-
                      Prefer subscription credits: ceil(max variant
                      duration)×15. If balance cannot cover the whole job,
                      PAYGO at ~$0.00015/s; no half-credit mix.
          x-gitbook-description-html: <p>Cover job submitted. Poll GET /v1/text-to-music/cover/{task_id}.</p>
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          description: >-
            Insufficient credits and no payment method on file (or monthly
            hard limit reached). This endpoint has no duration parameter,
            so the pre-flight check always requires 2700 credits, a
            payment method, or `invoice` billing.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 402
                message: Insufficient credits or payment method
        '400':
          description: Validation error (missing source, lyrics, or melody_adherence)
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
      x-gitbook-description-html: >-
        <p>Submit a YuE2 cover from a source track. Billing matches
        text-to-music (15 credits/s, PAYGO ~$0.00015/s). Monthly free /
        daily preview are not available on the API.</p>
  /text-to-music/cover/{task_id}:
    get:
      operationId: getTextToMusicCover
      tags:
        - Text to Music
      summary: Query a cover job and both variants
      description: >-
        Poll the cover task. `results` contains both variants. Billing
        settles once both variants have succeeded — the longer of the 2
        determines `effective_duration` and `credit_cost`; if either
        fails, nothing is charged. You can also poll a single variant with
        `GET /v1/text-to-music/{gen_product_id}`. Rate limited to 60
        requests / 60 seconds.
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
          description: The cover task_id returned by POST /v1/text-to-music/cover
          x-gitbook-description-html: <p>The cover task_id returned by POST /v1/text-to-music/cover</p>
      responses:
        '200':
          description: Status retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 0
                  message:
                    type: string
                    example: success
                  data:
                    type: object
                    properties:
                      task_id:
                        type: string
                      status:
                        type: string
                        enum: [submitted, running, succeeded, failed]
                      stage:
                        type: string
                      results:
                        type: array
                        items:
                          type: object
                          properties:
                            gen_product_id:
                              type: string
                            cover_task_id:
                              type: string
                            status:
                              type: string
                              enum: [submitted, running, succeeded, failed]
                            stage:
                              type: string
                              nullable: true
                            melody_adherence:
                              type: string
                              nullable: true
                            progress:
                              type: string
                              nullable: true
                            batch_id:
                              type: string
                            variant_index:
                              type: integer
                            title:
                              type: string
                              nullable: true
                            lyrics_generated:
                              type: string
                              nullable: true
                            duration:
                              type: number
                              nullable: true
                            audio_url:
                              type: string
                              nullable: true
                            credit_cost:
                              type: integer
                              nullable: true
                            effective_duration:
                              type: integer
                              nullable: true
                            credit_charged:
                              type: boolean
                            api_billing:
                              type: string
                              nullable: true
                              enum: [credits, paygo]
                            lyric_timings:
                              type: array
                              nullable: true
                              description: >-
                                Per-line lyric timestamps, present once this
                                variant succeeded — only if the job was
                                submitted with lyric_timestamps=true.
                              items:
                                type: object
                                properties:
                                  text:
                                    type: string
                                  start:
                                    type: number
                                  end:
                                    type: number
                            lyric_timings_engine:
                              type: string
                              nullable: true
                              enum: [mms, whisper]
                            lyric_timings_error:
                              type: object
                              nullable: true
                              properties:
                                code:
                                  type: string
                                  enum: [alignment_failed, aligner_unavailable]
                                message:
                                  type: string
              example:
                code: 0
                message: success
                data:
                  task_id: 8e21...
                  status: succeeded
                  stage: completed
                  results:
                    - gen_product_id: 3f9a...cm_v1_cm
                      cover_task_id: 8e21...
                      status: succeeded
                      melody_adherence: main_melody
                      duration: 121
                      audio_url: https://storage.googleapis.com/...
                      credit_cost: 2295
                      effective_duration: 153
                      credit_charged: true
                      api_billing: credits
                      lyric_timings:
                        - text: "[Verse 1] new words for the melody"
                          start: 11.22
                          end: 13.24
                      lyric_timings_engine: mms
                      lyric_timings_error: null
          x-gitbook-description-html: <p>Status retrieved successfully. Poll until status is succeeded or failed.</p>
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          description: Record not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
              example:
                code: 404
                message: Record not found
      x-gitbook-description-html: >-
        <p>Poll a cover task and both variants. Billing settles the first
        time a variant is observed as succeeded.</p>
  /media/generate:
    post:
      operationId: createMediaGeneration
      tags:
        - Media
      summary: Submit a text-to-image or text-to-video generation job (async)
      description: >-
        Submit an async image or video generation job from a text prompt,
        billed at official list price (not the discounted Studio
        case-template price) — see quality/resolution field descriptions
        for exact rates. v1 settles from subscription credits only, no
        PAYGO. Poll with `GET /v1/media/{gen_product_id}`. Rate limited to
        5 requests / 60 seconds. Error replies use HTTP 200 too — check
        `code` in the response body, not the status.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - prompt
              properties:
                prompt:
                  type: string
                  description: Required. 1-10000 characters.
                  x-gitbook-description-html: <p>Required. 1-10000 characters.</p>
                generation_type:
                  type: string
                  enum: [image, video]
                  default: image
                  description: What to generate.
                  x-gitbook-description-html: <p>What to generate.</p>
                model:
                  type: string
                  description: >-
                    Defaults to gpt-image-2 for images; video defaults to
                    the current MiniMax H3 model if omitted.
                  x-gitbook-description-html: <p>Defaults to gpt-image-2 for images; video defaults to the current MiniMax H3 model if omitted.</p>
                size:
                  type: string
                  description: Image size. Ignored for video — use resolution + aspect_ratio instead.
                  x-gitbook-description-html: <p>Image size. Ignored for video — use resolution + aspect_ratio instead.</p>
                output_format:
                  type: string
                  enum: [png, jpeg]
                  description: Image output format only.
                  x-gitbook-description-html: <p>Image output format only.</p>
                resolution:
                  type: string
                  description: >-
                    Video resolution, billed per second: Seedance
                    480p/720p/1080p at 3000/6000/16000 credits/s. MiniMax
                    H3 768P/2K at 250/500 credits/s, plus 150 credits per
                    reference image beyond the first 5 free.
                  x-gitbook-description-html: "<p>Video resolution, billed per second: Seedance 480p/720p/1080p at 3000/6000/16000 credits/s. MiniMax H3 768P/2K at 250/500 credits/s, plus 150 credits per reference image beyond the first 5 free.</p>"
                aspect_ratio:
                  type: string
                  description: Video aspect ratio.
                  x-gitbook-description-html: <p>Video aspect ratio.</p>
                quality:
                  type: string
                  enum: [low, medium]
                  description: Image quality tier — 500 credits/image at low, 1000 at medium.
                  x-gitbook-description-html: <p>Image quality tier — 500 credits/image at low, 1000 at medium.</p>
                count:
                  type: integer
                  minimum: 1
                  maximum: 4
                  description: Number of results to generate.
                  x-gitbook-description-html: <p>Number of results to generate.</p>
                seconds:
                  type: integer
                  minimum: 4
                  maximum: 15
                  description: Video length in seconds. Video only.
                  x-gitbook-description-html: <p>Video length in seconds. Video only.</p>
                generate_audio:
                  type: boolean
                  default: true
                  description: Whether the generated video should include audio.
                  x-gitbook-description-html: <p>Whether the generated video should include audio.</p>
                video_reference_mode:
                  type: string
                  enum: [omni, frames]
                  description: >-
                    omni (default): reference_images/reference_urls are
                    multi-modal references. frames: pair each reference
                    with a role in reference_roles.
                  x-gitbook-description-html: "<p>omni (default): reference_images/reference_urls are multi-modal references. frames: pair each reference with a role in reference_roles.</p>"
                reference_roles:
                  type: array
                  items:
                    type: string
                    enum: [first_frame, last_frame]
                  description: Only used when video_reference_mode=frames, positional with the reference images/URLs.
                  x-gitbook-description-html: <p>Only used when video_reference_mode=frames, positional with the reference images/URLs.</p>
                reference_images:
                  type: array
                  items:
                    type: string
                    format: binary
                  description: Reference image files.
                  x-gitbook-description-html: <p>Reference image files.</p>
                reference_urls:
                  type: array
                  items:
                    type: string
                  description: Reference image URLs (alternative to uploading files).
                  x-gitbook-description-html: <p>Reference image URLs (alternative to uploading files).</p>
                idempotency_key:
                  type: string
                  description: Optional. Prevents duplicate submissions on retry.
                  x-gitbook-description-html: <p>Optional. Prevents duplicate submissions on retry.</p>
      x-codeSamples:
        - lang: curl
          label: CURL
          source: |
            curl -X POST https://noiz.ai/v1/media/generate \
              -H "Authorization: YOUR_API_KEY" \
              -F "prompt=a neon-lit street at night, cinematic" \
              -F "generation_type=image" \
              -F "quality=medium" \
              -F "count=1"
      responses:
        '200':
          description: >-
            Job submitted, or a business-level error (see the ⚠️ note
            above — check `code`, not just the HTTP status).
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 0
                  message:
                    type: string
                    example: success
                  data:
                    type: object
                    properties:
                      gen_product_id:
                        type: string
                      status:
                        type: string
                        example: submitted
                      media_type:
                        type: string
                        enum: [image, video]
                      pricing:
                        type: object
                        properties:
                          note:
                            type: string
              examples:
                submitted:
                  value:
                    code: 0
                    message: success
                    data:
                      gen_product_id: img_abc123
                      status: submitted
                      media_type: image
                      pricing:
                        note: >-
                          Billed at official list price (no promotional
                          discount): images by count × per-image rate,
                          videos by ceil(seconds) × per-second rate for
                          the chosen resolution. Charged from subscription
                          credit balance once generation succeeds;
                          insufficient balance fails the request with no
                          charge (PAYGO not supported yet).
                insufficient_credit:
                  summary: HTTP 200 with a business-level 402 — insufficient credit
                  value:
                    code: 402
                    message: Insufficient credit
                    data: {}
                rate_limited:
                  summary: HTTP 200 with a business-level 429 — rate limit exceeded (5 requests per 60 seconds)
                  value:
                    code: 429
                    message: Rate limit exceeded
                    data:
                      ttl: 42
          x-gitbook-description-html: <p>Job submitted successfully, or a business-level error (insufficient credit, rate limited) — check the code field, not just the HTTP status (see the note above).</p>
        '401':
          $ref: '#/components/responses/UnauthorizedError'
      x-gitbook-description-html: >-
        <p>Submit an async image or video generation job. Billed at
        official list price, not the discounted Studio case-template
        price. Poll gen_product_id with GET /v1/media/{gen_product_id}.</p>
  /media/{gen_product_id}:
    get:
      operationId: getMediaGeneration
      tags:
        - Media
      summary: Query a media generation job's status
      description: >-
        Poll for status by gen_product_id. Usage is recorded once, the
        first time status is observed as succeeded. Rate limited to 60
        requests / 60 seconds.
      parameters:
        - name: gen_product_id
          in: path
          required: true
          schema:
            type: string
          description: The gen_product_id to query
          x-gitbook-description-html: <p>The gen_product_id to query</p>
      responses:
        '200':
          description: >-
            Status retrieved, or a business-level error (see the note on
            POST /v1/media/generate).
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 0
                  message:
                    type: string
                    example: success
                  data:
                    type: object
                    properties:
                      gen_product_id:
                        type: string
                      status:
                        type: string
                        enum: [submitted, running, succeeded, failed]
                      media_type:
                        type: string
                        enum: [image, video]
                      prompt:
                        type: string
                      model:
                        type: string
                        nullable: true
                      size:
                        type: string
                        nullable: true
                      resolution:
                        type: string
                        nullable: true
                      seconds:
                        type: integer
                        nullable: true
                      count:
                        type: integer
                        description: Requested result count
                      result_count:
                        type: integer
                        description: Number of results generated so far
                      result_image_url:
                        type: array
                        nullable: true
                        items:
                          type: string
                        description: Signed download URLs, present once succeeded. Image jobs only.
                      result_video_url:
                        type: array
                        nullable: true
                        items:
                          type: string
                        description: Signed download URLs, present once succeeded. Video jobs only.
                      error:
                        type: object
                        nullable: true
                        properties:
                          code:
                            type: string
                          message:
                            type: string
                      created_at:
                        type: string
                      credit_cost:
                        type: integer
                        nullable: true
                      credit_charged:
                        type: boolean
              examples:
                succeeded:
                  value:
                    code: 0
                    message: success
                    data:
                      gen_product_id: img_abc123
                      status: succeeded
                      media_type: image
                      prompt: a neon-lit street at night, cinematic
                      model: gpt-image-2
                      size: null
                      resolution: null
                      seconds: null
                      count: 1
                      result_count: 1
                      result_image_url:
                        - https://storage.googleapis.com/...
                      result_video_url: null
                      error: null
                      created_at: "2026-09-29T12:00:00Z"
                      credit_cost: 1000
                      credit_charged: true
                not_found:
                  summary: HTTP 200 with a business-level 404
                  value:
                    code: 404
                    message: Record not found
                    data: {}
          x-gitbook-description-html: <p>Status retrieved, or a business-level error — check the code field, not just the HTTP status.</p>
        '401':
          $ref: '#/components/responses/UnauthorizedError'
      x-gitbook-description-html: >-
        <p>Poll for a media generation job's status by gen_product_id.
        Usage is recorded once, the first time status is observed as
        succeeded.</p>
  /speech-to-text:
    post:
      operationId: speechToText
      tags:
        - Speech to Text
      summary: Transcribe audio to text
      description: >-
        Upload an audio file and receive a multilingual transcription.
        Supports mp3, wav, m4a, ogg, flac, aac, and webm formats. Maximum
        duration is 10 minutes (600 seconds) and maximum file size is 50MB.
        Billed at $0.0006/second of audio.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: Audio file to transcribe (mp3/wav/m4a/ogg/flac/aac/webm, max 50MB, max 10 min)
                  x-gitbook-description-html: <p>Audio file to transcribe (mp3/wav/m4a/ogg/flac/aac/webm, max 50MB, max 10 min)</p>
                language:
                  type: string
                  description: >-
                    Language code (e.g. zh, en, ja, ko, fr, de, es). Leave empty for
                    automatic language detection.
                  x-gitbook-description-html: >-
                    <p>Language code (e.g. zh, en, ja, ko, fr, de, es). Leave empty
                    for automatic language detection.</p>
      x-codeSamples:
        - lang: http
          label: HTTP - Auto-detect language
          source: |
            POST /v1/speech-to-text HTTP/1.1
            Host: noiz.ai
            Authorization: YOUR_API_KEY
            Content-Type: multipart/form-data

            file=@audio.mp3
        - lang: http
          label: HTTP - Specify language
          source: |
            POST /v1/speech-to-text HTTP/1.1
            Host: noiz.ai
            Authorization: YOUR_API_KEY
            Content-Type: multipart/form-data

            file=@audio.mp3
            language=zh
        - lang: Shell
          label: cURL
          source: |
            curl -X POST "https://noiz.ai/v1/speech-to-text" \
              -H "Authorization: YOUR_API_KEY" \
              -F "file=@audio.mp3" \
              -F "language=zh"
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    description: Status code (0 = success)
                    x-gitbook-description-html: <p>Status code (0 = success)</p>
                  message:
                    type: string
                    description: Result message
                    x-gitbook-description-html: <p>Result message</p>
                  data:
                    type: object
                    properties:
                      language:
                        type: string
                        description: Detected or specified language code
                        x-gitbook-description-html: <p>Detected or specified language code</p>
                      transcript:
                        type: string
                        description: Full transcribed text
                        x-gitbook-description-html: <p>Full transcribed text</p>
                      duration:
                        type: number
                        description: Audio duration in seconds
                        x-gitbook-description-html: <p>Audio duration in seconds</p>
                      segments:
                        type: array
                        description: Time-stamped transcription segments with speaker info
                        x-gitbook-description-html: <p>Time-stamped transcription segments with speaker info</p>
                        items:
                          type: object
                          properties:
                            text:
                              type: string
                              description: Segment text
                            start:
                              type: number
                              description: Start time in seconds
                            end:
                              type: number
                              description: End time in seconds
                            spk:
                              type: integer
                              description: Speaker index (0-based)
              example:
                code: 0
                message: success
                data:
                  language: zh
                  transcript: 你好，欢迎使用 Noiz API。
                  duration: 3.5
                  segments:
                    - text: 你好，欢迎使用 Noiz API。
                      start: 0.0
                      end: 3.5
                      spk: 0
        '401':
          $ref: '#/components/responses/UnauthorizedError'
      x-gitbook-description-html: >-
        <p>Upload an audio file and receive a multilingual transcription.
        Supports mp3, wav, m4a, ogg, flac, aac, and webm formats. Maximum
        duration is 10 minutes and maximum file size is 50MB. Billed at
        $0.0006/second of audio.</p>
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
  responses:
    UnauthorizedError:
      description: API Key missing or invalid
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: integer
              message:
                type: string
          example:
            code: 401
            message: Missing API key
      x-gitbook-description-html: <p>API Key missing or invalid</p>
  schemas:
    Voice:
      type: object
      properties:
        id:
          type: integer
        voice_id:
          type: string
        display_name:
          type: string
        voice_type:
          type: string
        labels:
          type: string
        sample:
          type: string
          nullable: true
        meta:
          type: object
          properties:
            text:
              type: string
        url:
          type: string
        create_time:
          type: integer
