openapi: 3.0.0
info:
  title: Neurall API Docs
  version: 1.0.0
  description: >-
    Welcome to the **Neurall API**, your gateway to powerful AI-driven **media
    generation, editing, and processing**. Whether you're creating stunning
    visuals, enhancing media, or automating workflows, our API provides the
    tools you need to bring your ideas to life.  


    ## Getting Started  


    The Neurall API is designed for seamless integration and high performance.
    To begin, make sure to follow these key requirements:  


    - **Base URL**: All API requests should be directed to:
    https://api.neurall.io


    - **Secure Communication**: All requests **must** be made over **HTTPS**.
    Any attempt to use plain HTTP will result in failure.  

    - **Authentication**: Every request requires an **API Key** for
    authorization. You can manage API Keys in the Neurall app by navigating to
    **Projects → API Keys**.


    ## Concurrency Limits


    By default, each organization is limited to **100 concurrent API requests**.
    This ensures optimal performance and reliability for all users. If your use
    case requires a higher concurrency limit, please contact our support team at
    <a href="mailto:support&#64;neurall&#46;io">support&#64;neurall&#46;io</a>
    to request an increase.  

    All additional requests beyond this limit will return a **429 Too Many
    Requests** error.


    ## Next Steps  


    Explore our **comprehensive endpoints**, experiment with **real-time
    AI-powered transformations**, and start building with Neurall today!  
servers:
  - url: https://api.neurall.io
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
tags:
  - name: Images
    description: >
      The **Images** section provides endpoints for AI-powered image generation,
      enhancement, and manipulation.  

      These tools allow you to create, modify, and optimize images through a
      range of advanced processing techniques.
  - name: AI Cloning
    description: >
      The **AI Cloning** section provides endpoints for training and managing
      AI-generated clones of subjects. Using a set of images, you can train an
      AI Cloning model to replicate a subject's appearance.  

      Once the training is complete, generate new images by calling
      **/v1/images/pegasus-generation** and passing the **identity_id**
      parameter in the request.
  - name: Audio
    description: >
      The **Audio** section provides advanced speech processing capabilities.
      Convert spoken words into precise text transcriptions with accurate
      **timestamps** for each word, enabling seamless integration into
      captioning, analytics, and more.  
paths:
  /v1/images/generation:
    post:
      summary: Generation
      description: This endpoint generates an image based on a given text prompt.
      security:
        - ApiKeyAuth: []
      tags:
        - Images
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                prompt:
                  type: string
                  description: A text description of the desired image content.
                negative_prompt:
                  type: string
                  description: >-
                    A text description of elements to exclude from the generated
                    image.
                width:
                  type: integer
                  description: The image width in pixels. Must be between 512 and 1024.
                  default: 1024
                height:
                  type: integer
                  description: The image height in pixels. Must be between 512 and 1024.
                  default: 1024
              required:
                - prompt
      responses:
        '200':
          description: Image generated in PNG format
          content:
            image/png:
              schema:
                type: string
                format: binary
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '429':
          description: Too Many Requests
        '500':
          description: Internal Exception
      x-codeSamples:
        - label: Node.js
          lang: Node.js
          source: |
            const axios = require('axios');
            const fs = require('fs');
            const FormData = require('form-data');

            // Create form data
            const form = new FormData();
            form.append('prompt', '{{PROMPT}}');
            form.append('negative_prompt', '{{NEGATIVE_PROMPT}}');
            form.append('width', '{{WIDTH}}');
            form.append('height', '{{HEIGHT}}');

            // Make request
            axios.post('https://api.neurall.io/v1/images/generation', form, {
                headers: {
                    ...form.getHeaders(),
                    authorization: '{{YOUR_API_KEY_HERE}}'
                },
                responseType: 'arraybuffer' // Expecting binary response
            }).then((response) => {
                fs.writeFileSync('output.png', response.data);
                console.log('Image received and saved as output.png');
            }).catch((err) => {
                console.error('Error in request: ', err);
            })
        - label: Python
          lang: Python
          source: |
            import requests
            import os

            # Create form data
            data = {
                'prompt': '{{PROMPT}}',
                'negative_prompt': '{{NEGATIVE_PROMPT}}',
                'width': '{{WIDTH}}',
                'height': '{{HEIGHT}}'
            }

            # Make request
            response = requests.post(
                'https://api.neurall.io/v1/images/generation',
                data=data,
                headers={
                    'Authorization': '{{YOUR_API_KEY_HERE}}'
                }
            )

            # Save the image
            if response.status_code == 200:
                with open('output.png', 'wb') as f:
                    f.write(response.content)
                print('Image received and saved as output.png')
            else:
                print('Error in request: ', response.text)
        - label: C#
          lang: C#
          source: |
            using System;
            using System.IO;
            using System.Net.Http;
            using System.Net.Http.Headers;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main(string[] args)
                {
                    var client = new HttpClient();
                    var form = new MultipartFormDataContent();

                    form.Add(new StringContent("{{PROMPT}}"), "prompt");
                    form.Add(new StringContent("{{NEGATIVE_PROMPT}}"), "negative_prompt");
                    form.Add(new StringContent("{{WIDTH}}"), "width");
                    form.Add(new StringContent("{{HEIGHT}}"), "height");

                    client.DefaultRequestHeaders.Add("Authorization", "{{YOUR_API_KEY_HERE}}");

                    try
                    {
                        var response = await client.PostAsync("https://api.neurall.io/v1/images/generation", form);
                        response.EnsureSuccessStatusCode();

                        var responseData = await response.Content.ReadAsByteArrayAsync();
                        await File.WriteAllBytesAsync("output.png", responseData);

                        Console.WriteLine("Image received and saved as output.png");
                    }
                    catch (Exception ex)
                    {
                        Console.Error.WriteLine("Error in request: " + ex.Message);
                    }
                }
            }
        - label: curl
          lang: curl
          source: |
            curl -f -X POST https://api.neurall.io/v1/images/generation \
                -H "Authorization: {{YOUR_API_KEY_HERE}}" \
                -F "prompt={{PROMPT}}" \
                -F "negative_prompt={{NEGATIVE_PROMPT}}" \
                -F "width={{WIDTH}}" \
                -F "height={{HEIGHT}}" \
                --output output.png
  /v1/images/pegasus-generation:
    post:
      summary: Pegasus Generation
      description: >-
        This endpoint generates an image based on a prompt, using the advanced
        Pegasus model.
      security:
        - ApiKeyAuth: []
      tags:
        - Images
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                prompt:
                  type: string
                  description: >-
                    A textual description of what should appear in the generated
                    image.
                width:
                  type: integer
                  description: >-
                    The desired width of the image, which must be between 512
                    and 1024 pixels.
                  default: 1024
                height:
                  type: integer
                  description: >-
                    The desired height of the image, which must be between 512
                    and 1024 pixels.
                  default: 1024
                identity_id:
                  type: string
                  description: >-
                    The ID of a trained identity to be used with the
                    identity-preserving feature. The identity must first be
                    trained using the Pegasus training endpoint.
                  default: ''
                artistic:
                  type: boolean
                  description: >-
                    Enables the artistic checkpoint for identity preservation.
                    This option reduces resemblance to the original identity but
                    allows for more creative freedom in artistic prompts.
                  default: false
              required:
                - prompt
      responses:
        '200':
          description: Image generated in PNG format
          content:
            image/png:
              schema:
                type: string
                format: binary
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '429':
          description: Too Many Requests
        '500':
          description: Internal Exception
      x-codeSamples:
        - label: Node.js
          lang: Node.js
          source: >
            const axios = require('axios');

            const fs = require('fs');

            const FormData = require('form-data');


            // Create form data

            const form = new FormData();

            form.append('prompt', '{{PROMPT}}');

            form.append('width', '{{WIDTH}}');

            form.append('height', '{{HEIGHT}}');


            // Make request

            axios.post('https://api.neurall.io/v1/images/pegasus-generation',
            form, {
                headers: {
                    ...form.getHeaders(),
                    authorization: '{{YOUR_API_KEY_HERE}}'
                },
                responseType: 'arraybuffer' // Expecting binary response
            }).then((response) => {
                fs.writeFileSync('output.png', response.data);
                console.log('Image received and saved as output.png');
            }).catch((err) => {
                console.error('Error in request: ', err);
            })
        - label: Python
          lang: Python
          source: |
            import requests
            import os

            # Create form data
            form_data = {
                'prompt': '{{PROMPT}}',
                'width': '{{WIDTH}}',
                'height': '{{HEIGHT}}'
            }

            # Make request
            response = requests.post(
                'https://api.neurall.io/v1/images/pegasus-generation',
                files=form_data,
                headers={
                    'Authorization': '{{YOUR_API_KEY_HERE}}'
                }
            )

            # Save the response as an image file
            if response.status_code == 200:
                with open('output.png', 'wb') as f:
                    f.write(response.content)
                print('Image received and saved as output.png')
            else:
                print('Error:', response.json())
        - label: C#
          lang: C#
          source: |
            using System;
            using System.IO;
            using System.Net.Http;
            using System.Net.Http.Headers;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main(string[] args)
                {
                    var prompt = "{{PROMPT}}";
                    var width = "{{WIDTH}}";
                    var height = "{{HEIGHT}}";

                    var client = new HttpClient();
                    var form = new MultipartFormDataContent();

                    form.Add(new StringContent(prompt), "prompt");
                    form.Add(new StringContent(width), "width");
                    form.Add(new StringContent(height), "height");

                    client.DefaultRequestHeaders.Add("Authorization", "{{YOUR_API_KEY_HERE}}");

                    try
                    {
                        var response = await client.PostAsync("https://api.neurall.io/v1/images/pegasus-generation", form);
                        response.EnsureSuccessStatusCode();

                        var responseData = await response.Content.ReadAsByteArrayAsync();
                        await File.WriteAllBytesAsync("output.png", responseData);

                        Console.WriteLine("Image received and saved as output.png");
                    }
                    catch (HttpRequestException e)
                    {
                        Console.Error.WriteLine($"Error: {e.Message}");
                    }
                }
            }
        - label: curl
          lang: curl
          source: |
            curl -X POST https://api.neurall.io/v1/images/pegasus-generation \
                -H "Authorization: {{YOUR_API_KEY_HERE}}" \
                -F "prompt={{PROMPT}}" \
                -F "width={{WIDTH}}" \
                -F "height={{HEIGHT}}" \
                --output output.png
  /v1/images/face-swapping:
    post:
      summary: Face Swapping
      description: >-
        This endpoint performs advanced face swapping by applying a face from
        one image onto a target image. Ideal for realistic or creative face
        merge applications.
      security:
        - ApiKeyAuth: []
      tags:
        - Images
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                source:
                  type: string
                  format: binary
                  description: >-
                    The image containing the face to be transferred. Maximum
                    size is **30MB**, and resolution must not exceed **16
                    Megapixels**.
                target:
                  type: string
                  format: binary
                  description: >-
                    The image onto which the source face will be applied. Must
                    match file size and resolution limits **30MB** and **16
                    Megapixels**.
                mask:
                  type: string
                  format: binary
                  description: >-
                    An optional image that defines the specific facial region to
                    be swapped. White areas indicate regions to include in the
                    swap, while black areas are excluded. The mask image must
                    have the same dimensions as the target image and must not
                    exceed **30MB**. When a mask is provided, the
                    **`target_face_x`** and **`target_face_y`** parameters are
                    ignored. This feature supports swapping only **one face at a
                    time**.
                target_face_x:
                  type: integer
                  description: >-
                    X-coordinate on the target image indicating the approximate
                    center point of the face. Useful when multiple faces are
                    present.
                target_face_y:
                  type: integer
                  description: >-
                    Y-coordinate on the target image indicating the approximate
                    center point of the face. Useful when multiple faces are
                    present.
              required:
                - source
                - target
      responses:
        '200':
          description: Image generated in PNG format
          content:
            image/png:
              schema:
                type: string
                format: binary
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '429':
          description: Too Many Requests
        '500':
          description: Internal Exception
      x-codeSamples:
        - label: Node.js
          lang: Node.js
          source: |
            const axios = require('axios');
            const fs = require('fs');
            const FormData = require('form-data');

            // Create form data
            const form = new FormData();
            form.append('source', fs.createReadStream('path/to/source.png'));
            form.append('target', fs.createReadStream('path/to/target.png'));
            form.append('mask', fs.createReadStream('path/to/mask.png')); 

            // Make request
            axios.post('https://api.neurall.io/v1/images/face-swapping', form, {
                headers: {
                    ...form.getHeaders(),
                    authorization: '{{YOUR_API_KEY_HERE}}'
                },
                responseType: 'arraybuffer' // Expecting binary response
            }).then((response) => {
                fs.writeFileSync('output.png', response.data);
                console.log('Image received and saved as output.png');
            }).catch((err) => {
                console.error('Error in request: ', err);
            })
        - label: Python
          lang: Python
          source: |
            import requests
            import os

            # Define the file paths
            source_path = 'path/to/source.png'
            target_path = 'path/to/target.png'
            mask_path = 'path/to/mask.png'
            output_path = 'output.png'

            # Define the API endpoint and headers
            url = 'https://api.neurall.io/v1/images/face-swapping'
            headers = {
                'authorization': '{{YOUR_API_KEY_HERE}}'
            }

            # Create the form data
            files = {
                'source': open(source_path, 'rb'),
                'target': open(target_path, 'rb'),
                'mask': open(mask_path, 'rb')
            }

            # Make the request
            response = requests.post(url, headers=headers, files=files)

            # Check if the request was successful
            if response.status_code == 200:
                with open(output_path, 'wb') as f:
                    f.write(response.content)
                print('Image received and saved as output.png')
            else:
                print('Error in request: ', response.status_code, response.text)
        - label: C#
          lang: C#
          source: |
            using System;
            using System.IO;
            using System.Net.Http;
            using System.Net.Http.Headers;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main(string[] args)
                {
                    var sourcePath = "path/to/source.png";
                    var targetPath = "path/to/target.png";
                    var maskPath = "path/to/mask.png";
                    var outputFilePath = "output.png";

                    var client = new HttpClient();
                    var form = new MultipartFormDataContent();

                    form.Add(new StreamContent(File.OpenRead(sourcePath)), "source", Path.GetFileName(sourcePath));
                    form.Add(new StreamContent(File.OpenRead(targetPath)), "target", Path.GetFileName(targetPath));
                    form.Add(new StreamContent(File.OpenRead(maskPath)), "mask", Path.GetFileName(maskPath));

                    client.DefaultRequestHeaders.Add("Authorization", "{{YOUR_API_KEY_HERE}}");

                    try
                    {
                        var response = await client.PostAsync("https://api.neurall.io/v1/images/face-swapping", form);
                        response.EnsureSuccessStatusCode();

                        var responseData = await response.Content.ReadAsByteArrayAsync();
                        await File.WriteAllBytesAsync(outputFilePath, responseData);

                        Console.WriteLine("Image received and saved as output.png");
                    }
                    catch (Exception ex)
                    {
                        Console.Error.WriteLine("Error in request: " + ex.Message);
                    }
                }
            }
        - label: curl
          lang: curl
          source: |
            curl -f -X POST https://api.neurall.io/v1/images/face-swapping \
                -H "Authorization: {{YOUR_API_KEY_HERE}}" \
                -F "source=@path/to/source.png" \
                -F "target=@path/to/target.png" \
                -F "mask=@path/to/mask.png" \
                --output output.png
  /v1/images/generative-fill:
    post:
      summary: Generative Fill
      description: >-
        Performs generative fill on the specified masked area of the provided
        image using a natural language prompt. The API takes an input image, a
        mask image (where white areas define the region to fill), and a text
        prompt describing what should be generated in the masked region. The
        result is a high-quality image with the masked area seamlessly filled
        according to the prompt.
      security:
        - ApiKeyAuth: []
      tags:
        - Images
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                image:
                  type: string
                  format: binary
                  description: >-
                    The image to be edited. Maximum size is **30MB**, and
                    resolution must not exceed **16 Megapixels**.
                mask:
                  type: string
                  format: binary
                  description: >-
                    An optional image that defines the specific area to be
                    altered. White areas indicate regions to include in the
                    swap, while black areas are excluded. The mask image must
                    have the same dimensions as the target image and must not
                    exceed **30MB**.
                prompt:
                  type: string
                  description: >-
                    A text description of the content to be generated in the
                    masked area. The model will use this prompt to fill the
                    specified regions seamlessly while preserving the rest of
                    the image.
              required:
                - source
                - target
      responses:
        '200':
          description: Image generated in PNG format
          content:
            image/png:
              schema:
                type: string
                format: binary
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '429':
          description: Too Many Requests
        '500':
          description: Internal Exception
      x-codeSamples:
        - label: Node.js
          lang: Node.js
          source: >
            const axios = require('axios');

            const fs = require('fs');

            const FormData = require('form-data');


            // Create form data

            const form = new FormData();

            form.append('image', fs.createReadStream('path/to/image.png'));

            form.append('mask', fs.createReadStream('path/to/mask.png'));

            form.append('prompt', '{{PROMPT}}');


            // Make request

            axios.post('https://api.neurall.io/v1/images/generative-fill', form,
            {
                headers: {
                    ...form.getHeaders(),
                    authorization: '{{YOUR_API_KEY_HERE}}'
                },
                responseType: 'arraybuffer' // Expecting binary response
            }).then((response) => {
                fs.writeFileSync('output.png', response.data);
                console.log('Image received and saved as output.png');
            }).catch((err) => {
                console.error('Error in request: ', err);
            })
        - label: Python
          lang: Python
          source: >-
            import requests

            import os


            # Define the file paths

            image_path = 'path/to/image.png'

            mask_path = 'path/to/mask.png'

            output_path = 'output.png'


            # Define the API endpoint and headers

            url = 'https://api.neurall.io/v1/images/generative-fill'

            headers = {
                'authorization': '{{YOUR_API_KEY_HERE}}'
            }


            # Create the form data

            files = {
                'image': open(image_path, 'rb'),
                'mask': open(mask_path, 'rb')
            }


            # Create the additional data

            data = {
                'prompt': '{{PROMPT}}'
            }


            # Make the request

            response = requests.post(url, headers=headers, files=files,
            data=data)


            # Check if the request was successful

            if response.status_code == 200:
                with open(output_path, 'wb') as f:
                    f.write(response.content)
                print('Image received and saved as output.png')
            else:
                print('Error in request: ', response.status_code, response.text)
        - label: C#
          lang: C#
          source: |
            using System;
            using System.IO;
            using System.Net.Http;
            using System.Net.Http.Headers;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main(string[] args)
                {
                    var imagePath = "path/to/image.png";
                    var maskPath = "path/to/mask.png";
                    var prompt = "{{PROMPT}}";
                    var outputFilePath = "output.png";

                    var client = new HttpClient();
                    var form = new MultipartFormDataContent();

                    form.Add(new StreamContent(File.OpenRead(imagePath)), "image", Path.GetFileName(imagePath));
                    form.Add(new StreamContent(File.OpenRead(maskPath)), "mask", Path.GetFileName(maskPath));
                    form.Add(new StringContent(prompt), "prompt");

                    client.DefaultRequestHeaders.Add("Authorization", "{{YOUR_API_KEY_HERE}}");

                    try
                    {
                        var response = await client.PostAsync("https://api.neurall.io/v1/images/generative-fill", form);
                        response.EnsureSuccessStatusCode();

                        var responseData = await response.Content.ReadAsByteArrayAsync();
                        await File.WriteAllBytesAsync(outputFilePath, responseData);

                        Console.WriteLine("Image received and saved as output.png");
                    }
                    catch (Exception ex)
                    {
                        Console.Error.WriteLine("Error in request: " + ex.Message);
                    }
                }
            }
        - label: curl
          lang: curl
          source: |
            curl -f -X POST https://api.neurall.io/v1/images/generative-fill \
                -H "Authorization: {{YOUR_API_KEY_HERE}}" \
                -F "image=@path/to/image.png" \
                -F "mask=@path/to/mask.png" \
                -F "prompt={{PROMPT}}" \
                --output output.png
  /v1/images/reimagine:
    post:
      summary: Reimagine
      description: >-
        The Reimagine endpoint generates high-quality visual variations of an
        input image while preserving its core structure, layout, and
        composition. It outputs an image with the same aspect ratio as the
        source and renders it at up to **1 Megapixel resolution**. This is ideal
        for creating new versions of a photo with subtle or creative
        differences, without losing the original identity.
      security:
        - ApiKeyAuth: []
      tags:
        - Images
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                image:
                  type: string
                  format: binary
                  description: >-
                    The base image to be reimagined. Supported formats include
                    JPEG, PNG, and WebP. The file size must not exceed 30MB, and
                    the resolution must not exceed 16 Megapixels.
                denoise:
                  type: number
                  description: >-
                    A number between 0.0 and 1.0 that controls how much the
                    output differs from the input image.
                  minimum: 0
                  maximum: 1
                  default: 0.7
              required:
                - image
      responses:
        '200':
          description: Image generated in PNG format
          content:
            image/png:
              schema:
                type: string
                format: binary
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '429':
          description: Too Many Requests
        '500':
          description: Internal Exception
      x-codeSamples:
        - label: Node.js
          lang: Node.js
          source: |
            const axios = require('axios');
            const fs = require('fs');
            const FormData = require('form-data');

            // Create form data
            const form = new FormData();
            form.append('image', fs.createReadStream('path/to/image.png'));
            form.append('denoise', '{{DENOISE}}')

            // Make request
            axios.post('https://api.neurall.io/v1/images/reimagine', form, {
                headers: {
                    ...form.getHeaders(),
                    authorization: '{{YOUR_API_KEY_HERE}}'
                },
                responseType: 'arraybuffer' // Expecting binary response
            }).then((response) => {
                fs.writeFileSync('output.png', response.data);
                console.log('Image received and saved as output.png');
            }).catch((err) => {
                console.error('Error in request: ', err);
            })
        - label: Python
          lang: Python
          source: >
            import requests


            # Create form data

            files = {
                'image': open('path/to/image.png', 'rb')
            }

            data = {
                'denoise': '{{DENOISE}}',
            }

            headers = {
                'authorization': '{{YOUR_API_KEY_HERE}}'
            }


            # Make request

            response =
            requests.post('https://api.neurall.io/v1/images/reimagine',
            files=files, data=data, headers=headers)


            # Save the response content as an image

            if response.status_code == 200:
                with open('output.png', 'wb') as f:
                    f.write(response.content)
                print('Image received and saved as output.png')
            else:
                print('Error in request: ', response.status_code, response.text)
        - label: C#
          lang: C#
          source: |
            using System;
            using System.IO;
            using System.Net.Http;
            using System.Net.Http.Headers;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main(string[] args)
                {
                    var client = new HttpClient();
                    var form = new MultipartFormDataContent();

                    // Add image file
                    var imageContent = new StreamContent(File.OpenRead("path/to/image.png"));
                    imageContent.Headers.ContentType = MediaTypeHeaderValue.Parse("image/png");
                    form.Add(imageContent, "image", "image.png");

                    // Add other form data
                    form.Add(new StringContent("{{DENOISE}}"), "denoise");

                    // Set authorization header
                    client.DefaultRequestHeaders.Add("Authorization", "{{YOUR_API_KEY_HERE}}");

                    try
                    {
                        // Make request
                        var response = await client.PostAsync("https://api.neurall.io/v1/images/reimagine", form);
                        response.EnsureSuccessStatusCode();

                        // Save response to file
                        var responseData = await response.Content.ReadAsByteArrayAsync();
                        File.WriteAllBytes("output.png", responseData);
                        Console.WriteLine("Image received and saved as output.png");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error in request: " + ex.Message);
                    }
                }
            }
        - label: curl
          lang: curl
          source: |
            curl -f -X POST https://api.neurall.io/v1/images/reimagine \
                -H "Authorization: {{YOUR_API_KEY_HERE}}" \
                -F "image=@path/to/image.png" \
                -F "denoise={{DENOISE}}"
                --output output.png
  /v1/images/upscaling:
    post:
      summary: Upscaling
      description: >-
        Enhances the resolution of an image. By default, the image is upscaled
        by a factor of 4, or until one of its dimensions reaches 4096 pixels,
        whichever comes first.
      security:
        - ApiKeyAuth: []
      tags:
        - Images
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                image:
                  type: string
                  format: binary
                  description: >-
                    The image file in JPEG, PNG, or WebP format. The file size
                    must not exceed 20MB, and the resolution must not exceed 8
                    Megapixels.
              required:
                - image
      responses:
        '200':
          description: The upscaled image, returned in PNG format.
          content:
            image/png:
              schema:
                type: string
                format: binary
        '400':
          description: Invalid request parameters.
        '401':
          description: Unauthorized access.
        '429':
          description: Too Many Requests
        '500':
          description: Internal server error.
      x-codeSamples:
        - label: Node.js
          lang: Node.js
          source: |
            const axios = require('axios');
            const fs = require('fs');
            const FormData = require('form-data');

            // Create form data
            const form = new FormData();
            form.append('image', fs.createReadStream('path/to/image.png'));

            // Make request
            axios.post('https://api.neurall.io/v1/images/upscaling', form, {
                headers: {
                    ...form.getHeaders(),
                    authorization: '{{YOUR_API_KEY_HERE}}'
                },
                responseType: 'arraybuffer' // Expecting binary response
            }).then((response) => {
                fs.writeFileSync('output.png', response.data);
                console.log('Image received and saved as output.png');
            }).catch((err) => {
                console.error('Error in request: ', err);
            })
        - label: Python
          lang: Python
          source: |
            import requests

            # Define the path to the image and the API key
            image_path = 'path/to/image.png'
            api_key = '{{YOUR_API_KEY_HERE}}'

            # Create form data
            with open(image_path, 'rb') as image_file:
                files = {'image': image_file}

                # Make request
                response = requests.post(
                    'https://api.neurall.io/v1/images/upscaling',
                    files=files,
                    headers={'authorization': api_key}
                )

                # Check if the request was successful
                if response.status_code == 200:
                    with open('output.png', 'wb') as output_file:
                        output_file.write(response.content)
                    print('Image received and saved as output.png')
                else:
                    print('Error in request: ', response.status_code, response.text)
        - label: C#
          lang: C#
          source: |
            using System;
            using System.IO;
            using System.Net.Http;
            using System.Net.Http.Headers;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main(string[] args)
                {
                    var apiKey = "{{YOUR_API_KEY_HERE}}";
                    var imagePath = "path/to/image.png";
                    var outputPath = "output.png";

                    var httpClient = new HttpClient();
                    var form = new MultipartFormDataContent();

                    // Add image to form data
                    var imageContent = new StreamContent(File.OpenRead(imagePath));
                    imageContent.Headers.ContentType = MediaTypeHeaderValue.Parse("image/png");
                    form.Add(imageContent, "image", Path.GetFileName(imagePath));

                    // Set headers
                    client.DefaultRequestHeaders.Add("Authorization", "{{YOUR_API_KEY_HERE}}");

                    try
                    {
                        // Make request
                        var response = await httpClient.PostAsync("https://api.neurall.io/v1/images/upscaling", form);
                        response.EnsureSuccessStatusCode();

                        // Save response to file
                        var responseData = await response.Content.ReadAsByteArrayAsync();
                        File.WriteAllBytes(outputPath, responseData);

                        Console.WriteLine("Image received and saved as output.png");
                    }
                    catch (Exception ex)
                    {
                        Console.Error.WriteLine("Error in request: " + ex.Message);
                    }
                }
            }
        - label: curl
          lang: curl
          source: |
            curl -f -X POST https://api.neurall.io/v1/images/upscaling \
                -H "Authorization: {{YOUR_API_KEY_HERE}}" \
                -F "image=@path/to/image.png" \
                --output output.png
  /v1/images/object-removal:
    post:
      summary: Object Removal
      description: >-
        Removes an object from an image using AI-powered inpainting, based on a
        provided mask.
      security:
        - ApiKeyAuth: []
      tags:
        - Images
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                image:
                  type: string
                  format: binary
                  description: >-
                    The input image in JPEG, PNG, or WebP format. The file must
                    not exceed 30MB in size or 16 Megapixels in resolution.
                mask:
                  type: string
                  format: binary
                  description: >-
                    The mask image in JPEG, PNG, or WebP format. The mask must
                    have the same resolution as the input image. It should be a
                    black-and-white image where white areas indicate the regions
                    to be removed and replaced. The file must not exceed 30MB in
                    size or 16 Megapixels in resolution.
              required:
                - image
                - mask
      responses:
        '200':
          description: The processed image with the object removed, returned in PNG format.
          content:
            image/png:
              schema:
                type: string
                format: binary
        '400':
          description: Invalid request parameters.
        '401':
          description: Unauthorized access.
        '429':
          description: Too Many Requests
        '500':
          description: Internal server error.
      x-codeSamples:
        - label: Node.js
          lang: Node.js
          source: >
            const axios = require('axios');

            const fs = require('fs');

            const FormData = require('form-data');


            // Create form data

            const form = new FormData();

            form.append('image', fs.createReadStream('path/to/image.png'));

            form.append('mask', fs.createReadStream('path/to/mask.png'));


            // Make request

            axios.post('https://api.neurall.io/v1/images/object-removal', form,
            {
                headers: {
                    ...form.getHeaders(),
                    authorization: '{{YOUR_API_KEY_HERE}}'
                },
                responseType: 'arraybuffer' // Expecting binary response
            }).then((response) => {
                fs.writeFileSync('output.png', response.data);
                console.log('Image received and saved as output.png');
            }).catch((err) => {
                console.error('Error in request: ', err);
            })
        - label: Python
          lang: Python
          source: |
            import requests
            import os

            # Define the file paths
            image_path = 'path/to/image.png'
            mask_path = 'path/to/mask.png'
            output_path = 'output.png'

            # Define the API endpoint and headers
            url = 'https://api.neurall.io/v1/images/object-removal'
            headers = {
                'authorization': '{{YOUR_API_KEY_HERE}}'
            }

            # Create the form data
            files = {
                'image': open(image_path, 'rb'),
                'mask': open(mask_path, 'rb')
            }

            # Make the request
            response = requests.post(url, headers=headers, files=files)

            # Check if the request was successful
            if response.status_code == 200:
                with open(output_path, 'wb') as f:
                    f.write(response.content)
                print('Image received and saved as output.png')
            else:
                print('Error in request: ', response.status_code, response.text)
        - label: C#
          lang: C#
          source: |
            using System;
            using System.IO;
            using System.Net.Http;
            using System.Net.Http.Headers;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main(string[] args)
                {
                    var imagePath = "path/to/image.png";
                    var maskPath = "path/to/mask.png";
                    var outputFilePath = "output.png";

                    var client = new HttpClient();
                    var form = new MultipartFormDataContent();

                    form.Add(new StreamContent(File.OpenRead(imagePath)), "image", Path.GetFileName(imagePath));
                    form.Add(new StreamContent(File.OpenRead(maskPath)), "mask", Path.GetFileName(maskPath));

                    client.DefaultRequestHeaders.Add("Authorization", "{{YOUR_API_KEY_HERE}}");

                    try
                    {
                        var response = await client.PostAsync("https://api.neurall.io/v1/images/object-removal", form);
                        response.EnsureSuccessStatusCode();

                        var responseData = await response.Content.ReadAsByteArrayAsync();
                        await File.WriteAllBytesAsync(outputFilePath, responseData);

                        Console.WriteLine("Image received and saved as output.png");
                    }
                    catch (Exception ex)
                    {
                        Console.Error.WriteLine("Error in request: " + ex.Message);
                    }
                }
            }
        - label: curl
          lang: curl
          source: |
            curl -f -X POST https://api.neurall.io/v1/images/object-removal \
                -H "Authorization: {{YOUR_API_KEY_HERE}}" \
                -F "image=@path/to/image.png" \
                -F "mask=@path/to/mask.png" \
                --output output.png
  /v1/images/extension:
    post:
      summary: Extension
      description: >-
        Extends the image by intelligently generating additional content on the
        specified sides. The final image resolution, including the extended
        area, must not exceed 16 Megapixels.
      security:
        - ApiKeyAuth: []
      tags:
        - Images
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                image:
                  type: string
                  format: binary
                  description: >-
                    The input image in JPEG, PNG, or WebP format. The file size
                    must not exceed 30MB, and the resolution (including the
                    extended content) must remain under 16 Megapixels.
                top:
                  type: integer
                  description: Number of pixels to extend the image at the top.
                bottom:
                  type: integer
                  description: Number of pixels to extend the image at the bottom.
                left:
                  type: integer
                  description: Number of pixels to extend the image on the left side.
                right:
                  type: integer
                  description: Number of pixels to extend the image on the right side.
              required:
                - image
      responses:
        '200':
          description: The extended image, returned in PNG format.
          content:
            image/png:
              schema:
                type: string
                format: binary
        '400':
          description: Invalid request parameters.
        '401':
          description: Unauthorized access.
        '429':
          description: Too Many Requests
        '500':
          description: Internal server error.
      x-codeSamples:
        - label: Node.js
          lang: Node.js
          source: |
            const axios = require('axios');
            const fs = require('fs');
            const FormData = require('form-data');

            // Create form data
            const form = new FormData();
            form.append('image', fs.createReadStream('path/to/image.png'));
            form.append('top', '{{TOP}}')
            form.append('bottom', '{{BOTTOM}}')
            form.append('left', '{{LEFT}}')
            form.append('right', '{{RIGHT}}')

            // Make request
            axios.post('https://api.neurall.io/v1/images/extension', form, {
                headers: {
                    ...form.getHeaders(),
                    authorization: '{{YOUR_API_KEY_HERE}}'
                },
                responseType: 'arraybuffer' // Expecting binary response
            }).then((response) => {
                fs.writeFileSync('output.png', response.data);
                console.log('Image received and saved as output.png');
            }).catch((err) => {
                console.error('Error in request: ', err);
            })
        - label: Python
          lang: Python
          source: >
            import requests


            # Create form data

            files = {
                'image': open('path/to/image.png', 'rb')
            }

            data = {
                'top': '{{TOP}}',
                'bottom': '{{BOTTOM}}',
                'left': '{{LEFT}}',
                'right': '{{RIGHT}}'
            }

            headers = {
                'authorization': '{{YOUR_API_KEY_HERE}}'
            }


            # Make request

            response =
            requests.post('https://api.neurall.io/v1/images/extension',
            files=files, data=data, headers=headers)


            # Save the response content as an image

            if response.status_code == 200:
                with open('output.png', 'wb') as f:
                    f.write(response.content)
                print('Image received and saved as output.png')
            else:
                print('Error in request: ', response.status_code, response.text)
        - label: C#
          lang: C#
          source: |
            using System;
            using System.IO;
            using System.Net.Http;
            using System.Net.Http.Headers;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main(string[] args)
                {
                    var client = new HttpClient();
                    var form = new MultipartFormDataContent();

                    // Add image file
                    var imageContent = new StreamContent(File.OpenRead("path/to/image.png"));
                    imageContent.Headers.ContentType = MediaTypeHeaderValue.Parse("image/png");
                    form.Add(imageContent, "image", "image.png");

                    // Add other form data
                    form.Add(new StringContent("{{TOP}}"), "top");
                    form.Add(new StringContent("{{BOTTOM}}"), "bottom");
                    form.Add(new StringContent("{{LEFT}}"), "left");
                    form.Add(new StringContent("{{RIGHT}}"), "right");

                    // Set authorization header
                    client.DefaultRequestHeaders.Add("Authorization", "{{YOUR_API_KEY_HERE}}");

                    try
                    {
                        // Make request
                        var response = await client.PostAsync("https://api.neurall.io/v1/images/extension", form);
                        response.EnsureSuccessStatusCode();

                        // Save response to file
                        var responseData = await response.Content.ReadAsByteArrayAsync();
                        File.WriteAllBytes("output.png", responseData);
                        Console.WriteLine("Image received and saved as output.png");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error in request: " + ex.Message);
                    }
                }
            }
        - label: curl
          lang: curl
          source: |
            curl -f -X POST https://api.neurall.io/v1/images/extension \
                -H "Authorization: {{YOUR_API_KEY_HERE}}" \
                -F "image=@path/to/image.png" \
                -F "top={{TOP}}" \
                -F "bottom={{BOTTOM}}" \
                -F "left={{LEFT}}" \
                -F "right={{RIGHT}}" \
                --output output.png
  /v1/images/text-removal:
    post:
      summary: Text Removal
      description: >-
        Detects and removes text from an image using AI-powered inpainting to
        seamlessly fill the removed areas.
      security:
        - ApiKeyAuth: []
      tags:
        - Images
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                image:
                  type: string
                  format: binary
                  description: >-
                    The input image in JPEG, PNG, or WebP format. The file must
                    not exceed 30MB in size or 16 Megapixels in resolution.
              required:
                - image
      responses:
        '200':
          description: The processed image with text removed, returned in PNG format.
          content:
            image/png:
              schema:
                type: string
                format: binary
        '400':
          description: Invalid request parameters.
        '401':
          description: Unauthorized access.
        '429':
          description: Too Many Requests
        '500':
          description: Internal server error.
      x-codeSamples:
        - label: Node.js
          lang: Node.js
          source: |
            const axios = require('axios');
            const fs = require('fs');
            const FormData = require('form-data');

            // Create form data
            const form = new FormData();
            form.append('image', fs.createReadStream('path/to/image.png'));

            // Make request
            axios.post('https://api.neurall.io/v1/images/text-removal', form, {
                headers: {
                    ...form.getHeaders(),
                    authorization: '{{YOUR_API_KEY_HERE}}'
                },
                responseType: 'arraybuffer' // Expecting binary response
            }).then((response) => {
                fs.writeFileSync('output.png', response.data);
                console.log('Image received and saved as output.png');
            }).catch((response) => {
                console.error('Error in request: ', err);
            })
        - label: Python
          lang: Python
          source: |
            import requests
            import os

            # Define the path to the image and the API key
            image_path = 'path/to/image.png'
            api_key = '{{YOUR_API_KEY_HERE}}'

            # Open the image file in binary mode
            with open(image_path, 'rb') as image_file:
                # Create the form data
                files = {'image': image_file}

                # Make the request
                response = requests.post(
                    'https://api.neurall.io/v1/images/text-removal',
                    files=files,
                    headers={'Authorization': api_key}
                )

                # Check if the request was successful
                if response.status_code == 200:
                    # Save the response content to a file
                    with open('output.png', 'wb') as output_file:
                        output_file.write(response.content)
                    print('Image received and saved as output.png')
                else:
                    print('Error:', response.content)
        - label: C#
          lang: C#
          source: |
            using System;
            using System.IO;
            using System.Net.Http;
            using System.Net.Http.Headers;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main(string[] args)
                {
                    var imagePath = "path/to/image.png";
                    var outputFilePath = "output.png";

                    var client = new HttpClient();
                    var form = new MultipartFormDataContent();

                    form.Add(new StreamContent(File.OpenRead(imagePath)), "image", Path.GetFileName(imagePath));
             
                    client.DefaultRequestHeaders.Add("Authorization", "{{YOUR_API_KEY_HERE}}");

                    try
                    {
                        var response = await client.PostAsync("https://api.neurall.io/v1/images/text-removal", form);
                        response.EnsureSuccessStatusCode();

                        var responseData = await response.Content.ReadAsByteArrayAsync();
                        await File.WriteAllBytesAsync(outputFilePath, responseData);

                        Console.WriteLine("Image received and saved as output.png");
                    }
                    catch (Exception ex)
                    {
                        Console.Error.WriteLine("Error in request: " + ex.Message);
                    }
                }
            }
        - label: curl
          lang: curl
          source: |
            curl -f -X POST https://api.neurall.io/v1/images/text-removal \
                -H "Authorization: {{YOUR_API_KEY_HERE}}" \
                -F "image=@path/to/image.png" \
                --output output.png
  /v1/images/background-removal:
    post:
      summary: Background Removal
      description: >-
        Removes the background from an image, returning either the subject with
        a transparent background or a mask highlighting the detected subject.
      security:
        - ApiKeyAuth: []
      tags:
        - Images
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                image:
                  type: string
                  format: binary
                  description: >-
                    The input image in JPEG, PNG, or WebP format. The file must
                    not exceed 30MB in size or 25 Megapixels in resolution.
                return_mask:
                  type: boolean
                  description: >-
                    If set to `true`, the API returns a binary mask instead of
                    the processed image with the background removed.
                  default: true
              required:
                - image
                - return_mask
      responses:
        '200':
          description: >-
            The processed image with the background removed, returned in PNG
            format.
          content:
            image/png:
              schema:
                type: string
                format: binary
        '400':
          description: Invalid request parameters.
        '401':
          description: Unauthorized access.
        '429':
          description: Too Many Requests
        '500':
          description: Internal server error.
      x-codeSamples:
        - label: Node.js
          lang: Node.js
          source: >
            const axios = require('axios');

            const fs = require('fs');

            const FormData = require('form-data');


            // Create form data

            const form = new FormData();

            form.append('image', fs.createReadStream('path/to/image.png'));


            // Make request

            axios.post('https://api.neurall.io/v1/images/background-removal',
            form, {
                headers: {
                    ...form.getHeaders(),
                    authorization: '{{YOUR_API_KEY_HERE}}'
                },
                responseType: 'arraybuffer' // Expecting binary response
            }).then((response) => {
                fs.writeFileSync('output.png', response.data);
                console.log('Image received and saved as output.png');
            }).catch((err) => {
                console.error('Error in request: ', err);
            })
        - label: Python
          lang: Python
          source: |
            import requests

            # Define the API endpoint and your API key
            url = 'https://api.neurall.io/v1/images/background-removal'
            api_key = '{{YOUR_API_KEY_HERE}}'

            # Open the image file in binary mode
            with open('path/to/image.png', 'rb') as image_file:
                # Create the form data
                files = {'image': image_file}
                
                # Set the headers
                headers = {
                    'Authorization': api_key
                }
                
                # Make the request
                response = requests.post(url, files=files, headers=headers)
                
                # Check if the request was successful
                if response.status_code == 200:
                    # Save the response content to a file
                    with open('output.png', 'wb') as output_file:
                        output_file.write(response.content)
                    print('Image received and saved as output.png')
                else:
                    print('Error in request: ', response.status_code, response.text)
        - label: C#
          lang: C#
          source: |
            using System;
            using System.IO;
            using System.Net.Http;
            using System.Net.Http.Headers;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main(string[] args)
                {
                    var client = new HttpClient();
                    var form = new MultipartFormDataContent();

                    // Add image file to form data
                    var imageContent = new StreamContent(File.OpenRead("path/to/image.png"));
                    imageContent.Headers.ContentType = MediaTypeHeaderValue.Parse("image/png");
                    form.Add(imageContent, "image", "image.png");

                    // Set authorization header
                    client.DefaultRequestHeaders.Add("Authorization", "{{YOUR_API_KEY_HERE}}");

                    try
                    {
                        // Make request
                        var response = await client.PostAsync("https://api.neurall.io/v1/images/background-removal", form);

                        // Ensure the request was successful
                        response.EnsureSuccessStatusCode();

                        // Read response as byte array
                        var responseData = await response.Content.ReadAsByteArrayAsync();

                        // Save response data to file
                        await File.WriteAllBytesAsync("output.png", responseData);
                        Console.WriteLine("Image received and saved as output.png");
                    }
                    catch (Exception ex)
                    {
                        Console.Error.WriteLine("Error in request: " + ex.Message);
                    }
                }
            }
        - label: curl
          lang: curl
          source: >
            #!/bin/bash


            API_KEY="{{YOUR_API_KEY_HERE}}"

            IMAGE_PATH="path/to/image.png"

            OUTPUT_PATH="output.png"


            curl -f -X POST
            "https://api.neurall.io/v1/images/background-removal" \
                -H "authorization: $API_KEY" \
                -F "image=@$IMAGE_PATH" \
                --output $OUTPUT_PATH

            echo "Image received and saved as $OUTPUT_PATH"
  /v1/images/pegasus-training:
    post:
      summary: Training
      description: >-
        Trains an AI Cloning model to replicate the appearance of a subject
        using a provided set of images. Once the training is complete, you can
        generate images using the **`/v1/images/pegasus-generation`** endpoint
        by passing the **`identity_id`** parameter in the request.
      security:
        - ApiKeyAuth: []
      tags:
        - AI Cloning
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                images:
                  type: array
                  items:
                    type: string
                    format: binary
                  description: >-
                    A set of images in JPEG, PNG, or WebP format, each up to
                    5MB. A minimum of 5 and a maximum of 15 images are required
                    to train the AI Cloning model.
                callback:
                  type: string
                  description: >-
                    An optional URL to receive a POST request once training is
                    complete. The request will have an `application/json`
                    content type and include any data specified in the
                    `callback_params` object.
                  example: https://my-callback-url.mydomain.io/callback
                callback_params:
                  type: string
                  description: >-
                    If a callback URL is provided, this object will be included
                    in the request body. `callback_params` must be a valid
                    JSON-parsed object.
                  example: '{}'
              required:
                - images
      responses:
        '200':
          description: >-
            Training successfully completed, returning the unique identifier of
            the generated AI Clone.
          content:
            application/json:
              schema:
                type: object
                properties:
                  identityId:
                    type: string
                    description: >-
                      The unique identifier assigned to the trained AI Clone,
                      stored in the database.
                    example: a281923dhasdf72136
        '400':
          description: Invalid request parameters.
        '401':
          description: Unauthorized access.
        '429':
          description: Too Many Requests
        '500':
          description: Internal server error.
      x-codeSamples:
        - label: Node.js
          lang: Node.js
          source: >
            const axios = require('axios');

            const fs = require('fs');

            const FormData = require('form-data');


            // Create form data

            const form = new FormData();

            const imagePaths = [
                'path/to/image1.png',
                'path/to/image2.png',
                'path/to/image3.png',
                'path/to/image4.png',
                'path/to/image5.png',
                'path/to/image6.png',
                'path/to/image7.png',
                'path/to/image8.png',
                'path/to/image9.png',
                'path/to/image10.png'
            ]


            // Append images to form data

            for (let item of imagePaths) {
                form.append('images', fs.createReadStream(item));
            }


            // Make request

            axios.post('https://api.neurall.io/v1/images/pegasus-training',
            form, {
                headers: {
                    ...form.getHeaders(),
                    authorization: '{{YOUR_API_KEY_HERE}}'
                }
            }).then((response) => {
                console.log('Training started - IdentityId: ', response.data.identityId);
            }).catch((err) => {
                console.error('Error in request: ', err);
            })
        - label: Python
          lang: Python
          source: >
            import requests

            import os


            # Create form data

            image_paths = [
                'path/to/image1.png',
                'path/to/image2.png',
                'path/to/image3.png',
                'path/to/image4.png',
                'path/to/image5.png',
                'path/to/image6.png',
                'path/to/image7.png',
                'path/to/image8.png',
                'path/to/image9.png',
                'path/to/image10.png'
            ]


            files = [('images', (os.path.basename(path), open(path, 'rb'))) for
            path in image_paths]


            # Make request

            response = requests.post(
                'https://api.neurall.io/v1/images/pegasus-training',
                files=files,
                headers={'authorization': '{{YOUR_API_KEY_HERE}}'}
            )


            if response.status_code == 200:
                print('Training started - IdentityId:', response.json().get('identityId'))
            else:
                print('Error:', response.json())
        - label: C#
          lang: C#
          source: |
            using System;
            using System.Collections.Generic;
            using System.IO;
            using System.Net.Http;
            using System.Net.Http.Headers;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main(string[] args)
                {
                    var imagePaths = new List<string>
                    {
                        "path/to/image1.png",
                        "path/to/image2.png",
                        "path/to/image3.png",
                        "path/to/image4.png",
                        "path/to/image5.png",
                        "path/to/image6.png",
                        "path/to/image7.png",
                        "path/to/image8.png",
                        "path/to/image9.png",
                        "path/to/image10.png"
                    };

                    var client = new HttpClient();
                    var form = new MultipartFormDataContent();

                    foreach (var imagePath in imagePaths)
                    {
                        var fileStream = new FileStream(imagePath, FileMode.Open, FileAccess.Read);
                        var streamContent = new StreamContent(fileStream);
                        streamContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
                        form.Add(streamContent, "images", Path.GetFileName(imagePath));
                    }

                    client.DefaultRequestHeaders.Add("Authorization", "{{YOUR_API_KEY_HERE}}");

                    try
                    {
                        var response = await client.PostAsync("https://api.neurall.io/v1/images/pegasus-training", form);
                        response.EnsureSuccessStatusCode();
                        var responseBody = await response.Content.ReadAsStringAsync();
                        Console.WriteLine("Training started - IdentityId: " + responseBody);
                    }
                    catch (HttpRequestException e)
                    {
                        Console.WriteLine("Error: " + e.Message);
                    }
                }
            }
        - label: curl
          lang: curl
          source: |
            #!/bin/bash

            API_KEY="{{YOUR_API_KEY_HERE}}"
            URL="https://api.neurall.io/v1/images/pegasus-training"

            # Create an array of image paths
            imagePaths=(
                "path/to/image1.png"
                "path/to/image2.png"
                "path/to/image3.png"
                "path/to/image4.png"
                "path/to/image5.png"
                "path/to/image6.png"
                "path/to/image7.png"
                "path/to/image8.png"
                "path/to/image9.png"
                "path/to/image10.png"
            )

            # Initialize the curl command with the URL and headers
            curl_command="curl -f -X POST $URL -H 'Authorization: $API_KEY'"

            # Append each image to the curl command
            for image in "${imagePaths[@]}"; do
                curl_command+=" -F images=@$image"
            done

            # Execute the curl command
            eval $curl_command
  /v1/images/pegasus-status-training:
    post:
      summary: Training Status
      description: >-
        Retrieves the current status of one or more AI Cloning training
        processes.
      security:
        - ApiKeyAuth: []
      tags:
        - AI Cloning
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                identity_ids:
                  type: string
                  description: >-
                    A comma-separated list of identity IDs for which to check
                    the training status.
                  example: aajsu227sla,oquycbzwi2
              required:
                - identity_ids
      responses:
        '200':
          description: An object containing the status of the requested training processes.
          content:
            application/json:
              schema:
                type: object
                properties:
                  trainingStatus:
                    type: array
                    items:
                      type: object
                      properties:
                        identityId:
                          type: string
                          description: >-
                            The unique identifier of the AI Clone training
                            process.
                        status:
                          type: string
                          enum:
                            - pending
                            - training
                            - done
                            - error
                          description: The current status of the training process.
                example:
                  trainingStatus:
                    - identityId: aajsu227sla
                      status: done
                    - identityId: oquycbzwi2
                      status: pending
        '400':
          description: Invalid request parameters.
        '401':
          description: Unauthorized access.
        '429':
          description: Too Many Requests
        '500':
          description: Internal server error.
  /v1/images/pegasus-delete-training:
    post:
      summary: Delete AI Clone
      description: Permanently removes a trained AI Clone from the system.
      security:
        - ApiKeyAuth: []
      tags:
        - AI Cloning
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                identity_id:
                  type: string
                  description: The unique identifier of the AI Clone to be deleted.
              required:
                - identity_id
      responses:
        '200':
          description: The AI Clone was successfully deleted.
        '400':
          description: The request contains invalid parameters.
        '401':
          description: Authentication failed or missing permissions.
        '429':
          description: Too Many Requests
        '500':
          description: An internal server error occurred.
  /v1/speech/transcription:
    post:
      summary: Transcription
      description: Converts spoken audio into text and provides timestamps for each word.
      security:
        - ApiKeyAuth: []
      tags:
        - Audio
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                audio:
                  type: string
                  format: binary
                  description: >-
                    The audio file in MP3 format. The file size must not exceed
                    20MB, and the audio length should be a maximum of 5 minutes.
                language:
                  type: string
                  enum:
                    - af
                    - sq
                    - am
                    - ar
                    - hy
                    - as
                    - az
                    - ba
                    - eu
                    - be
                    - bn
                    - bs
                    - br
                    - bg
                    - yue
                    - ca
                    - zh
                    - hr
                    - cs
                    - da
                    - nl
                    - en
                    - et
                    - fo
                    - tl
                    - fi
                    - fr
                    - gl
                    - ka
                    - de
                    - el
                    - gu
                    - ht
                    - ha
                    - haw
                    - he
                    - hi
                    - hu
                    - is
                    - id
                    - it
                    - ja
                    - jw
                    - kn
                    - kk
                    - km
                    - ko
                    - lo
                    - la
                    - lv
                    - ln
                    - lt
                    - lb
                    - mk
                    - mg
                    - ms
                    - ml
                    - mt
                    - mi
                    - mr
                    - mn
                    - my
                    - ne
                    - 'no'
                    - nn
                    - oc
                    - ps
                    - fa
                    - pl
                    - pt
                    - pa
                    - ro
                    - ru
                    - sa
                    - sr
                    - sn
                    - sd
                    - si
                    - sk
                    - sl
                    - so
                    - es
                    - su
                    - sw
                    - sv
                    - tg
                    - ta
                    - tt
                    - te
                    - th
                    - bo
                    - tr
                    - tk
                    - uk
                    - ur
                    - uz
                    - vi
                    - cy
                    - yi
                    - yo
                  description: >-
                    The language of the speech. Must be one of the supported
                    language codes. If a language is not specified, the API will
                    try to autodetect the language based on the first 30 seconds
                    of audio.
              required:
                - audio
      responses:
        '200':
          description: Successfully generated transcription with word timestamps.
          content:
            application/json:
              schema:
                type: object
                properties:
                  segments:
                    type: array
                    items:
                      type: object
                      properties:
                        text:
                          type: string
                          example: Hello World
                        words:
                          type: array
                          items:
                            type: object
                            properties:
                              word:
                                type: string
                                description: The recognized word.
                              start:
                                type: number
                                description: Start time of the word in seconds.
                              end:
                                type: number
                                description: End time of the word in seconds.
                              score:
                                type: number
                                description: Confidence score of the transcription.
                          example:
                            - word: Hello
                              start: 0
                              end: 0.3
                              score: 0.9
                            - word: World
                              start: 0.3
                              end: 0.7
                              score: 0.95
        '400':
          description: Invalid request or unsupported file format.
        '401':
          description: Unauthorized access.
        '429':
          description: Too Many Requests
        '500':
          description: Internal server error.
      x-codeSamples:
        - label: Node.js
          lang: Node.js
          source: |
            const axios = require('axios');
            const fs = require('fs');
            const FormData = require('form-data');

            // Create form data
            const form = new FormData();
            form.append('image', fs.createReadStream('path/to/audio.mp3'));
            form.append('language', '{{LANGUAGE}}');

            // Make request
            axios.post('https://api.neurall.io/v1/speech/transcription', form, {
                headers: {
                    ...form.getHeaders(),
                    authorization: '{{YOUR_API_KEY_HERE}}'
                }
            }).then((response) => {
                console.log('Response received: ', response.data);
            }).catch((err) => {
                console.error('Error in request: ', err);
            })
        - label: Python
          lang: Python
          source: >
            import requests


            url = 'https://api.neurall.io/v1/speech/transcription'

            audio_file_path = 'path/to/audio.mp3'

            language = '{{LANGUAGE}}'

            api_key = '{{YOUR_API_KEY_HERE}}'


            # Create form data

            files = {
                'image': open(audio_file_path, 'rb')
            }

            data = {
                'language': language
            }

            headers = {
                'authorization': api_key
            }


            # Make request

            response = requests.post(url, files=files, data=data,
            headers=headers)


            if response.status_code == 200:
                print('Response received: ', response.json())
            else:
                print('Error:', response.json())
        - label: C#
          lang: C#
          source: |
            using System;
            using System.IO;
            using System.Net.Http;
            using System.Net.Http.Headers;
            using System.Threading.Tasks;

            class Program
            {
                static async Task Main(string[] args)
                {
                    var filePath = "path/to/audio.mp3";
                    var language = "{{LANGUAGE}}";

                    var client = new HttpClient();
                    var form = new MultipartFormDataContent();

                    form.Add(new StreamContent(File.OpenRead(filePath)), "image", Path.GetFileName(filePath));
                    form.Add(new StringContent(language), "language");

                    client.DefaultRequestHeaders.Add("Authorization", "{{YOUR_API_KEY_HERE}}");

                    try
                    {
                        var response = await client.PostAsync("https://api.neurall.io/v1/speech/transcription", form);
                        response.EnsureSuccessStatusCode();
                        var responseData = await response.Content.ReadAsStringAsync();
                        Console.WriteLine("Response received: " + responseData);
                    }
                    catch (HttpRequestException e)
                    {
                        Console.WriteLine("Error: " + e.Message);
                    }
                }
            }
        - label: curl
          lang: curl
          source: |
            curl -f -X POST 'https://api.neurall.io/v1/speech/transcription' \
                -H 'authorization: {{YOUR_API_KEY_HERE}}' \
                -F 'image=@path/to/audio.mp3' \
                -F 'language={{LANGUAGE}}'
