まずはこちら

APIリファレンス

認証、GPUのレンタル、アップロード、すべてのジョブタイプ、ポーリング、結果、利用制限。

エージェント向けのMarkdown版はこちら:https://aividart.com/docs/api.md Markdown

このガイドはエージェント向けに英語で書かれています。

This is the complete HTTP API an agent uses to make video, pictures, music, speech, transcripts and 3D models on AIVidArt. Read it fully before the first request. The workflow guides at https://aividart.com/docs/ describe what to make and in which order; this page describes how to call the service.

Base URL: https://aividart.com. Every path below is relative to it.

1. How the service works

  1. Rent a GPU. All generation runs on one GPU that belongs to the user alone for the rented hours (1–24 hours). The rental is paid up front in credits. Nothing is charged per job.
  2. Upload input files (pictures, videos, audio) with POST /api/uploads. Each upload returns a URL.
  3. Submit jobs with POST /api/jobs. A job names a kind, a mode, its params and its inputs (the URLs from step 2, or result URLs of earlier jobs).
  4. Poll GET /api/jobs/{id} until the status is succeeded, failed or canceled, then download the result URLs from outputs.

Jobs belong to the user, not to a rental. Jobs queue in the order they were submitted and run one after another on the rented GPU. If the rental ends while jobs are still queued, they keep their place and start on the user's next rental. A job still running when the rental ends is stopped and put back in the queue, to run again from the start on the next rental.

Rules the agent must follow

  • Renting spends the user's credits. Rent or extend only when the user has asked for it or clearly authorized it, and tell the user the hours and the credit cost first (GET /api/gpus/pricing). Rentals are not refunded on request; only a GPU failure refunds the unused time automatically.
  • Never print, log or commit the API key. Read it from the environment variable named by the user (normally AIVIDART_API_KEY).
  • Never submit the same job twice because a request timed out. List the recent jobs first (GET /api/jobs) and reconcile.
  • Files are kept for 2 days. Jobs, their results and uploaded inputs older than 48 hours are deleted. Download every result you want to keep to the local production folder as soon as it finishes.
  • At most 200 jobs may be queued or running at once, across all kinds. Submit in batches and wait for some to finish when the limit is reached.

2. Authentication and responses

Send the user's API key as a bearer token on every request:

export AIVIDART_API_KEY='avd_...'   # set by the user; never hard-code it
curl -fsS "https://aividart.com/api/rentals/active" -H "Authorization: Bearer $AIVIDART_API_KEY"

The key can do everything the studio does, including renting and extending GPUs. If it is refused (401), ask the user to create or replace it on the website: https://aividart.com/en/login?next=/en/user/api.

Send your own User-Agent header. The site, the API and the result files (file.aividart.com) refuse Python's default Python-urllib/… agent with HTTP 403 (error code: 1010) before the request reaches the service. Set a name of your own, for example User-Agent: my-agent/1.0, on every request, downloads included. curl, requests, Node and Go clients are accepted as they are.

Every response is HTTP 200 with a JSON envelope, except 401 for a missing or invalid key:

{ "success": true,  "data": { ... } }
{ "success": false, "message": "A sentence that can be shown to the user" }

Always check success. When it is false, the HTTP status is still 200 and message says what was wrong (for example insufficient credits, Rent a GPU to use the studio, a validation error). Lists are returned as { "list": [...], "total": n, "page": p, "page_size": s } where paginated.

3. GPUs and rentals

Request Body Returns
GET /api/gpus/pricing credits_per_hour, min_hours, max_hours
GET /api/credits/balance The user's credit balance
GET /api/gpus list of GPUs: id, name, gpu_model, vram_gb, online, rented, rented_until, mine
POST /api/rentals {"gpu_id": "...", "hours": 2} The new rental
GET /api/rentals/active {"rental": {...}, "gpu_online": true} or null
POST /api/rentals/{id}/extend {"hours": 1} The extended rental

A user holds at most one GPU at a time, and a GPU has at most one renter. Rent a GPU whose online is true and rented is false. A rental's total length (including extensions) is at most max_hours.

Rental object: id, gpu_id, gpu_name, hours, status (active / ended), end_reason (expired / gpu_offline), starts_at, ends_at. Times are UTC RFC 3339.

If renting fails with insufficient credits, stop and ask the user to top up on https://aividart.com/en/pricing.

H="Authorization: Bearer $AIVIDART_API_KEY"
curl -fsS "https://aividart.com/api/gpus" -H "$H"
curl -fsS -X POST "https://aividart.com/api/rentals" -H "$H" -H 'Content-Type: application/json' \
  -d '{"gpu_id":"<id from the list>","hours":2}'

Uploading and submitting both need a live rental. Before a long batch, check ends_at and ask the user whether to extend; jobs left in the queue are not lost when the rental ends, but they wait for the next one.

4. Uploading input files

POST /api/uploads, multipart form with two fields in this order: purpose, then file.

purpose Extensions Max size
image .png .jpg .jpeg .webp 10 MB, at most 40 megapixels
video .mp4 .mov .webm .mkv 300 MB
audio .wav .mp3 .m4a .flac .ogg .opus .aac 100 MB
media (transcription input) the audio types plus .mp4 .mov .webm .mkv .avi 256 MB
curl -fsS -X POST "https://aividart.com/api/uploads" -H "$H" \
  -F purpose=image -F 'file=@refs/characters/lin.png'
# {"success":true,"data":{"url":"https://.../uploads/...png","size":123456,"name":"lin.png"}}

Save the returned url next to the local file in the production records. At most 4 uploads may run at the same time and 300 per hour per user, and at most 5 GB per user in any 48 hours (uploads are deleted after 48 hours, which frees the allowance). Upload each file once and reuse its URL; never re-upload the same file. An input URL must be one of the user's own uploads, or a result URL of one of the user's own jobs (for example a generated picture used as a first frame): results can be passed straight back as inputs without downloading and uploading them again.

5. Submitting jobs

POST /api/jobs with a JSON body (at most 512 KB):

{
  "kind": "video",
  "mode": "r2v",
  "params": { "prompt": "...", "resolution": "768p", "duration": 10, "aspect_ratio": "16:9" },
  "inputs": { "ref_image": ["https://.../lin.png", "https://.../workshop.png"] }
}

The response is the new job object (section 7). inputs maps a field name to a list of URLs; the order of the list is the order the model sees, so <Picture 1> in a prompt is the first URL of the field. Unknown fields for a mode are refused. GET /api/studio/options returns the current limits and choices as JSON.

Every mode accepts an optional seed (a whole number up to 10 digits) in params; without one a random seed is used.

5.1 Video: kind = "video"

mode What it does inputs
t2v Text to video optional audio (1)
i2v First frame, or first + last frame image (1, required), optional last_image (1), optional audio (1)
r2v Reference video: keeps people, places and objects from reference pictures/videos ref_image (up to 6), ref_video (up to 3), optional audio (1)
upscale 2x upscale of a finished video (section 5.7) none
params field Default / range Notes
prompt required, up to 20,000 characters Use the prompt layouts in the directing guide
resolution 768p; 544p / 768p 16:9 is 1344×768 or 960×544; other ratios keep about the same pixel area
duration 5; 2–15 seconds Snaps to 17k+5 frames at 24 fps, so 5 s → 124 frames (5.17 s), 10 s → 243 (10.125 s), 15 s → 362 (15.08 s)
aspect_ratio 16:9; 16:9 9:16 4:3 3:4 1:1 image image follows the first input picture or reference video
audio_start 0 Start offset in seconds into the guide audio, when one is given
title first words of the prompt Up to 80 characters, for the job list
  • In i2v, <Picture 1> is the first frame and <Picture 2> the last frame. A missing keyframe tag is added to the prompt automatically.
  • In r2v, reference pictures are <Picture 1>, <Picture 2>, … in upload order; reference videos are <Video 1>, … (each at least 2 seconds, trimmed to the job length), their soundtracks <Audio 1>, …. Subject numbering for videos continues after the pictures. r2v with no references also works, from the prompt alone.
  • audio is a guide soundtrack the video follows (speech, music or effects), usable in every mode.
  • First/last frames and references cannot be mixed in one job.
  • The model and its sampling settings are fixed per mode. There are no model, step or sampler fields.

Typical render times on one GPU at 768p, sound included: t2v 5 s ≈ 37 s, 10 s ≈ 75 s, 15 s ≈ 122 s; i2v 15 s ≈ 128 s; fl2v 15 s ≈ 138 s; r2v 10 s ≈ 128 s, 15 s ≈ 195 s. A picture takes about 3 s (an edit about 5 s), a minute of speech about 18 s, an hour of audio transcribes in about 2 min.

curl -fsS -X POST "https://aividart.com/api/jobs" -H "$H" -H 'Content-Type: application/json' -d @- <<'JSON'
{"kind":"video","mode":"i2v",
 "params":{"prompt":"<Picture 1> is the first frame: ...","resolution":"768p","duration":10,"aspect_ratio":"image"},
 "inputs":{"image":["https://.../firstframes/S001.png"]}}
JSON

Build JSON bodies with a real JSON encoder (for example Python's json.dumps) so prompts with quotes and newlines are escaped correctly; do not paste prompts into shell strings.

5.2 Pictures: kind = "image"

mode What it does inputs
t2i Text to picture none
i2i Edit or compose from up to 4 pictures ref_image (1–4, required)
params field Default / range Notes
prompt required, up to 20,000 characters Refer to inputs as "the woman from image 2"
aspect_ratio 1:1; 16:9 9:16 4:3 3:4 1:1 t2i only. An edit always keeps the canvas of the first input picture

Pictures are about one megapixel. To get a landscape edit, put a landscape picture (for example the empty location) first.

5.3 Music: kind = "music", mode = "t2m"

params field Default / range Notes
prompt required Style, tempo, instruments, vocals
lyrics optional, up to 20,000 characters Section tags such as [Verse], [Chorus]; for an instrumental, use instrumental section tags only
duration 120; 10–300 seconds A maximum: the song may come out shorter. Measure the result

No inputs. The result is an MP3.

5.4 Speech: kind = "speech", mode = "tts"

params field Default / range Notes
prompt required, up to 4,000 characters The words to speak. Split longer narration at paragraphs
speech_mode generate; generate / clone / design Preset voice, clone a recording, or design a voice from a description
voice Vivian generate only: Vivian Serena Uncle_Fu Dylan Eric Ryan Aiden Ono_Anna Sohee
language auto auto zh en ja ko de fr ru pt es it
instruction up to 4,000 characters Delivery for generate; required voice description for design; ignored for clone
reference_text optional, up to 4,000 characters clone: the words actually spoken in the recording

Inputs: voice_audio (1, required for clone; 0.2–30 seconds of audio, or a video with sound). Not accepted in the other modes. The result is an MP3. Speech reports little progress while it runs; a progress of 0 does not mean it has stalled.

5.5 Transcription: kind = "asr", mode = "asr"

params field Default / range Notes
language auto A language name or ISO code, for example English, Chinese, en
timestamps word; none / word / segment word aligns every word; segment groups aligned words into subtitle lines
file_name optional Shown as the job title

Inputs: media (1, required): audio, or a video with sound, up to 2 hours (upload purpose media). Timestamps are real forced alignment, in seconds on the original media timeline.

5.6 Image to 3D: kind = "3d", mode = "i23d"

params field Default / range
mesh_resolution 1024; 1024 / 1536
texture_size 2048; 1024 / 2048 / 4096
remove_background true / false, default true

Inputs: image (1, required). The result is a GLB.

5.7 Upscaling a finished video: kind = "video", mode = "upscale"

{ "kind": "video", "mode": "upscale", "params": { "source_job_id": "<finished video job id>", "factor": "2x" }, "inputs": {} }
params field Default / range Notes
source_job_id required A succeeded video job of this user (not itself an upscale)
factor 2x (the only factor) Width and height are multiplied exactly
seed optional
  • 2x turns 768p into 1536 on the short side and 544p into 1088.
  • The source must be at most 16 seconds long (every video job is at most 15 s, so any clip qualifies).
  • It works on any rented GPU: the source is the video stored with the source job, not a file on the GPU that made it. It therefore needs the source job to still exist: upscale within the 2-day retention.
  • Frame count, frame rate and audio are kept. A 15 s 768p clip takes roughly 44 s at 2x.
  • Upscale clean segments before captions or titles are burned in, then assemble.

6. Following, canceling and deleting jobs

Request Notes
GET /api/jobs/{id} One job
GET /api/jobs?kind=video&page=1&page_size=20 The user's jobs, newest first; kind is optional (video includes upscales); page_size up to 100
POST /api/jobs/{id}/cancel Cancels a queued job at once. A running job cannot be canceled: it always runs to the end
DELETE /api/jobs/{id} Deletes a finished, failed or canceled job and its result files

Poll each pending job about every 10–15 seconds from one background helper, not in a tight loop. queue_position (1 = next) tells how many of the user's jobs are ahead. A queued job whose error says the rental ended is waiting for the next rental; it has not failed.

To stop a production, cancel its queued jobs; the one already running finishes, and its result is kept. Check a job before submitting it: once it starts, you cannot cancel it. The only exception is the end of the rental: a job still running then is stopped and put back in the queue.

7. The job object

Field Meaning
id Job id
kind, mode, title As submitted (title derived from the prompt when not given)
params, inputs The normalized request
status queued → running → succeeded / failed / canceled
queue_position 1-based place among the user's queued jobs; 0 when not queued
stage, progress Current stage and its progress from 0 to 1 (not a uniform estimate of the whole job)
error Why it failed, or a note on a queued job that was put back
outputs Result URLs (below), empty until succeeded
width, height, duration Actual size and length of the result (seconds)
render_seconds GPU time the job took
gpu_id, rental_id Where it ran (empty while queued)
created_at, started_at, finished_at UTC RFC 3339

outputs by kind:

Kind Keys
video video (MP4, H.264 + AAC), poster (JPEG)
image image (PNG)
music, speech audio (MP3)
asr text (the transcript), transcripts: a map of txt, json, words, srt, vtt URLs (only the files actually produced)
3d model (GLB), poster

Download results with a plain GET (no key needed, but with your own User-Agent) through a temporary file and an atomic rename, so a partial download never looks finished. Remember the 2-day retention.

The transcription json file holds text, language, duration, words (start, end, text) and segments. Never invent word timings by spreading text evenly over a duration.

8. A minimal session

import json, os, time, urllib.request

SITE = "https://aividart.com"
KEY = os.environ["AIVIDART_API_KEY"]

def call(method, path, body=None):
    req = urllib.request.Request(SITE + path, method=method,
        data=json.dumps(body).encode() if body is not None else None,
        headers={"Authorization": "Bearer " + KEY, "Content-Type": "application/json",
                 "User-Agent": "my-agent/1.0"})  # the default Python-urllib agent gets 403
    with urllib.request.urlopen(req, timeout=120) as r:
        res = json.load(r)
    if not res.get("success"):
        raise RuntimeError(res.get("message"))
    return res.get("data")

active = call("GET", "/api/rentals/active")
if not active:
    raise SystemExit("No GPU rented: ask the user before renting one.")

job = call("POST", "/api/jobs", {"kind": "image", "mode": "t2i",
    "params": {"prompt": "An empty mountain radio workshop, rain on the window, no people, no text.",
               "aspect_ratio": "16:9"}, "inputs": {}})
while job["status"] in ("queued", "running"):
    time.sleep(15)
    job = call("GET", "/api/jobs/" + job["id"])
print(job["status"], job["outputs"].get("image"), job["error"])

Uploads are multipart; use curl -F purpose=... -F file=@... or a multipart library.

9. Limits at a glance

Limit Value
Rental length 1–24 hours per rental, including extensions
GPUs per user 1 at a time
Pending jobs 200 queued + running per user
Retention 2 days for jobs, results and uploads
JSON body 512 KB
Uploads 10 MB picture (≤ 40 MP), 300 MB video, 100 MB audio, 256 MB transcription media; 4 at a time, 300 per hour, 5 GB per 48 hours
Prompt 20,000 characters (speech text and voice fields: 4,000)
Video 2–15 s per job, 544p or 768p; up to 6 reference pictures and 3 reference videos
Picture edits up to 4 input pictures
Music 10–300 s
Transcription up to 2 hours
Upscale 2x only, source ≤ 16 s, within 2 days of the source