PixVerse /animate command

Table of contents

  1. Request Headers
  2. Request Body
  3. Responses
  4. Model
  5. Examples
  6. Try It

Use this endpoint to submit the PixVerse /animate command to your Discord PixVerse private thread channel. Results obtained as a callback via optional parameter replyUrl or by querying pixverse/jobs/?jobid=jobid endpoint.

It is important not to use the PixVerse account setup for API access for any purposes other than its intended use, such as executing /animate or any other PixVerse commands manually or in conjunction with any other automation tools. The useapi.net API internally tracks the usage of the PixVerse account, including the number of currently active executions. Using it for other activities may cause API to function incorrectly.

https://api.useapi.net/v1/pixverse/animate

Request Headers
Authorization: Bearer {API token}
Content-Type: multipart/form-data
Request Body
{
    "image": "Image (jpg/png/jpeg) File or Blob",
    "prompt": "Prompt",
    "motion": "Adjust the strength of motion in the content (1…10, default 5)",
    "seed_value": "Seed for the generation (0…2147483647)",
    "hd_quality": "Produces clearer & precise videos, but requires 1 to 2 times the longer generation time",
    "discord": "Discord token",
    "server": "Discord server id",
    "channel": "Discord channel id",
    "maxJobs": 10,
    "replyUrl": "Place your call back URL here",
    "replyRef": "Place your reference id here"
}
  • image is required, an image (jpg/png/jpeg) you want to animate. Must be either a File or Blob object when included in this FormData POST request.

  • prompt is optional, must contain PixVerse /animate prompt.
    Maximum length 512 characters.

  • motion is optional, adjust the strength of motion in the content.
    Supported range 1…10, default 5.

  • seed_value is optional, seed for the generation.
    Supported range 0…2147483647.

  • hd_quality is optional, produces clearer & precise videos, but requires 1 to 2 times the longer generation time.
    Must be one of following values: Yes, No.

  • discord, server, channel are optional, if not provided randomly selected available account from pixverse/account will be used. See Setup PixVerse for details.
    Note You may specify the channel value alone (omitting discord and server) when you wish to use a specific account from the configured list at pixverse/account.

  • maxJobs is optional, if not provided value for channel account selected above will be used, if not provided defaulted to 10.

  • replyUrl is optional, if not provided value from account will be used.
    Place here your callback URL. API will call the provided replyUrl once job completed or failed.
    Maximum length 1024 characters.
    We recommend using sites like webhook.site to test callback URL functionality.

  • replyRef is optional, place here your reference id which will be stored and returned along with this job response / result.
    Maximum length 1024 characters.

Responses
  • 200 OK

    Use returned jobid to retrieve PixVerse job status and results. content contains message generated by PixVerse reflecting current generation parameters and progress.

    {
        "jobid": "<jobid>",
        "verb": "pixverse-animate",
        "status": "started",
        "created": "2023-09-09T02:04:49.667Z",
        "updated": "2023-09-09T02:04:53.490Z",
        "image": { "size": 1628384, "type": "image/png" },
        "prompt": "smiling and blinking",
        "motion": 5,
        "seed_value": 12345,
        "hd_quality": "No",
        "discord": "<ABC…secured…xyz>",
        "server": "<Discord server id>",
        "channel": "<Discord channel id>",
        "maxJobs": 10,
        "replyUrl": "https://webhook.site/abc",
        "replyRef": "<your optional reference id>",
        "messageId": "<Discord message id>",
        "content": "<@Discord user id> We are making videos. We will notify you when it's done. ([image attached](<https://cdn.discordapp.com/ephemeral-attachments/…>) prompt: smiling and blinking motion: 5 HD Quality: None) Author: <@Discord user id>)",
        "timestamp": "2023-09-09T02:04:51.926000+00:00",
        "code": 200
    }
    
  • 400 Bad Request

    {
        "error": 
          "image, discord, server or channel value is missing"
          "prompt, replyRef or replyUrl is too long"
          "image is not File or Blob"
          "motion <motion> valid range 1-10, default 5"
          "seed_value <seed_value> valid range 0-2147483647"
          "hd_quality <hd_quality> not supported, must be one of Yes,No"
        "code": 400
    }
    
  • 401 Unauthorized

    {
        "error": "Unauthorized",
        "code": 401
    }
    
  • 402 Payment Required

    {
        "error": "Account has no subscription or subscription expired",
        "code": 402
    }
    
  • 422 Unprocessable Content

    Moderated message or invalid prompt params.

    {
        "error": "Apologies! Our AI moderator thinks this prompt or images as potentially violating our [community guidelines](<https://discord.com/channels/1140860020586713128/1168473004498501652>).",
        "jobid": "<jobid>",
        "status": "moderated",
        "code": 422
    }
    
  • 429 Too Many Requests

    Wait in a loop for at least 10..30 seconds and retry again.

    There are two possible cases for API response 429.

    1. API query is full and can not accept new pixverse/animate requests. Size of query defined by maxJobs optional parameter. Wait in a loop for at least 10..30 seconds and retry again.
      {
       "error": "Maximum of <maxJobs> jobs executing in parallel supported",
       "executingJobs": [
         "<jobid>",
         "<jobid>",
         "<jobid>"
       ],
       "code": 429
      }
      
    2. The API received an HTTP status 429 from the Discord API when it attempted to POST to the /interactions endpoint. Under normal circumstances, this should be a rare occurrence because the API is designed to strictly adhere to Discord rate limits. However, in certain scenarios, Discord may still issue a 429 response.
      {
       "error": "Discord /interactions failed with HTTP status 429",
       "errorDetails": "{\"global\":true,\"message\":\"You are being rate limited.\",\"retry_after\":10}",
       "code": 429
      }
      
Model
{ // TypeScript, all fields are optional
  jobid: string, // Use returned jobid value to retrieve job status and results
  verb: 'pixverse-animate',
  status: 'started' | 'moderated' | 'failed',
  created: string, // YYYY-MM-DDTHH:mm:ss.sssZ, IS0 8601, UTC
  updated: string, // YYYY-MM-DDTHH:mm:ss.sssZ, IS0 8601, UTC
  image: { size: number, type: string },
  prompt: string,
  motion: number,
  seed_value: number,
  hd_quality: string, 
  discord: string, // Provided for debugging purposes only, contains the first 3 and the last 3 characters of the original value
  server: string,
  channel: string,
  maxJobs: number,
  replyUrl: string,
  replyRef: string,
  messageId: string,
  content: string, // Contains message generated by PixVerse reflecting current generation parameters and progress
  timestamp: string,
  error: string,
  errorDetails: string,
  executingJobs: string[],
  code: number
}
Examples
  • curl -H "Accept: application/json" \
         -H "Authorization: Bearer …" \
         -X POST https://api.useapi.net/v1/pixverse/animate \
         -F "discord=<Discord token>" \
         -F "server=<Discord server id>" \
         -F "channel=<Discord channel id>" \
         -F 'image=@"<Path to the image>"' \
         -F "prompt=<PixVerse prompt>" 
    
  • const main = async () => {
        const apiUrl = "https://api.useapi.net/v1/pixverse/animate";
        const token = "API token";
        const prompt = "PixVerse prompt";
        const discord = "Discord token";
        const server = "Discord server";
        const channel = "Discord channel";
        const data = {
            method: 'POST',
            headers: {
                'Authorization': `Bearer ${token}`
            }
        };
        const formData = new FormData();
        formData.append("prompt", prompt);
        formData.append("discord", discord);
        formData.append("server", server);
        formData.append("channel", channel);
        /*
            // Example 1: Fetch image from URL
            const imageUrl = "https://upload.wikimedia.org/wikipedia/commons/7/7d/Mona_Lisa_color_restoration.jpg";
            const responseImage = await fetch(imageUrl);
            formData.append("image", await responseImage.blob());
        */
        /* 
            // Example 2: Load image from local file (Blob)
            const fsp = require('fs').promises;
            const imageFileName = "./pixverse.png";
            const blob = new Blob([await fsp.readFile(imageFileName)]);
            formData.append("image", blob);
        */
        /*
            // Example 3: Load from input file html element
            // <input id="pixverse-animate-image-url" type="file"> 
            const imageFile = document.getElementById(`pixverse-animate-image-file`);
            if (imageFile.files[0])
                formData.append("image", imageFile.files[0]);
        */
        data.body = formData;
        const response = await fetch(apiUrl, data);
        const result = await response.json();
        console.log("response", { response, result });
    };
    main()
    
  • import requests
    
    api_url = "https://api.useapi.net/v1/pixverse/animate"
    token = "API token"
    prompt = "PixVerse prompt"
    discord = "Discord token"
    server = "Discord server"
    channel = "Discord channel"
    
    headers = {
        'Authorization': f'Bearer {token}'
    }
    
    files = {
        'prompt': (None, prompt),
        'discord': (None, discord),
        'server': (None, server),
        'channel': (None, channel)
    }
    
    # # Example 1: Fetch image from URL
    # image_url = "https://upload.wikimedia.org/wikipedia/commons/7/7d/Mona_Lisa_color_restoration.jpg"
    # response_image = requests.get(image_url)
    # image_content = response_image.content
    # files['image'] = ('image.jpg', image_content, 'image/jpeg')
    
    # # Example 2: Load image from local file
    # image_file_path = "./pixverse.png"
    # with open(image_file_path, 'rb') as image_file:
    #     files['image'] = ('pixverse.png', image_file.read(), 'image/png')
    
    response = requests.post(api_url, headers=headers, files=files)
    print(response, response.json())
    
Try It