NSFWAI.tv API

Generate Seedance videos with the models behind NSFWAI.tv, in the official ByteDance Ark (Volcengine / BytePlus ModelArk) request format. If your code already calls Ark, change the base URL and the key and it runs as is.

Quick start

  1. Click Turn on API on your account page. You get a key right away and can make more there.
  2. Point your Ark SDK or HTTP client at https://api.nsfwai.tv/api/v3 instead of the official base URL, and use your NSFWAI.tv key.
  3. Create a task, then poll it or let us call you back when it is done.
# pip install 'volcengine-python-sdk[ark]'
import os, time
from volcenginesdkarkruntime import Ark

client = Ark(
    base_url="https://api.nsfwai.tv/api/v3",   # the only two lines that change
    api_key=os.environ["NSFWAI_API_KEY"],
)

task = client.content_generation.tasks.create(
    model="doubao-seedance-2-0-mini-260615",
    content=[{"type": "text", "text": "She turns slowly toward the camera in a candlelit room"}],
    ratio="9:16",
    duration=5,
    resolution="480p",
    generate_audio=True,
)

while True:
    t = client.content_generation.tasks.get(task_id=task.id)
    if t.status in ("succeeded", "failed", "cancelled", "expired"):
        break
    time.sleep(10)
print(t.status, t.content.video_url if t.status == "succeeded" else t.error)

Keys, task ids and URLs in the examples are examples. Credits are spent from your account balance, the same credits as on the site.

Authentication

Send your key as a bearer token on every request, the same header Ark uses:

HTTP header
Authorization: Bearer nt_live_xxxxxxxxxxxxxxxxxxxxxxxx
  • Keys start with nt_live_ and are shown once, when you create them. We keep only a hash.
  • An account can have up to 5 keys. Delete one on the account page and it stops working at once.
  • A key spends its account's credits: keep it on your server, never in an app or a web page.

Models & pricing

Send the official ByteDance model id or our short name in model; we also accept thedreamina-… and nsfw-seedance-… names. The model you sent is echoed back in the task.

Video · credits per second of video

ModelOfficial idShortLength480p720p1080p2K4K
Seedance 2.5doubao-seedance-2-5-260628sd254–30 sor -1 (auto)3672180108288
Seedance 2.5 Flashdoubao-seedance-2-5-flash-261115sd25flash4–30 sor -1 (auto)2448———
Seedance 2.0doubao-seedance-2-0-260128sd204–15 sor -1 (auto)244812084240
Seedance 2.0 Minidoubao-seedance-2-0-mini-260615sd20mini4–15 sor -1 (auto)1224486072
Seedance 2.0 Fastdoubao-seedance-2-0-fast-260128sd20fast4–15 sor -1 (auto)1839637587
Wan 3.0wan30wan304–15 sor -1 (auto)288288288288288
MiniMax H3mmh3mmh34–15 sor -1 (auto)288288288288288
  • A task costs rate × seconds. A 5 s Seedance 2.0 Mini video at 480p is 60 credits; sound on or off costs the same.
  • Reference videos are billed like output: each clip's length, rounded up to a whole second, is added to the seconds. Reference images and audio cost nothing extra.
  • duration: -1 (auto) is charged as the longest clip the model makes; when the video is done, the seconds it did not use are refunded.
  • Failed tasks are refunded in full, including ones the provider turns down for content.
  • Ratios: adaptive (default), 16:9, 9:16, 4:3, 3:4, 1:1, 21:9.

Reference files per task

ModelReferencesLongest reference clip
Seedance 2.530 images, 10 videos, 10 audio (50 in all)30 s
Seedance 2.5 Flash10 images, 5 videos, 5 audio (20 in all)30 s
Seedance 2.09 images, 3 videos, 3 audio (12 in all)15 s
Seedance 2.0 Mini9 images, 3 videos, 3 audio (12 in all)15 s
Seedance 2.0 Fast9 images, 3 videos, 3 audio (12 in all)15 s
Wan 3.09 images, 0 videos, 0 audio (9 in all)15 s
MiniMax H39 images, 3 videos, 3 audio (12 in all)15 s

Images Coming soon

The image formats are not live yet. Prices when they are, per image:

ModelId1K2KNotes
Seedream 5.5doubao-seedream-5-5-2610281830+8 per reference image after the first
Qwen Image 2.1qwen-image-2.1-turbo1616Reference images included

Create a video task

POSThttps://api.nsfwai.tv/api/v3/contents/generations/tasks

Asynchronous: the response is the task id; the video is made in the background. Fields you leave out or send as null take their default.

FieldTypeNotes
modelstringRequired. See Models.
contentarrayRequired. At most one text item (the prompt, up to 5,000 characters) and any reference files. A task needs a prompt or at least one file.
ratiostringadaptive (default) or a fixed ratio.
durationintegerSeconds, default 5; -1 lets the model choose (auto).
resolutionstring480p, 720p (default), 1080p, 2k, 4k, as the model allows.
generate_audiobooleanDefault true.
seedinteger-1 to 4294967295; -1 or unset picks one. The seed used is returned.
return_last_framebooleanAlso return the last frame as an image (content.last_frame_url).
callback_urlstringA public http(s) URL we POST the task to on every status change. See Callbacks.
execution_expires_afterintegerSeconds, 3600–259200, default 172800. A task not finished by then ends as expired and is refunded.
omni_reference_task_typestringSeedance 2.5 and 2.5 Flash: auto, reference, edit, extend. With only reference files we send reference.
output_formatstringmp4 (default) or mov (Seedance 2.5 series).
priority, safety_identifierAccepted and echoed back.
watermarkbooleanAccepted; videos are never watermarked.

content items

typeShaperole
text{ "type": "text", "text": "…" }—
image_url{ "type": "image_url", "image_url": { "url": "…" }, "role": "…" }first_frame, last_frame or reference_image
video_url{ "type": "video_url", "video_url": { "url": "…" } }reference_video
audio_url{ "type": "audio_url", "audio_url": { "url": "…" } }reference_audio

A file is a public http(s) URL or a base64 data URL (data:image/png;base64,…). We download it once and check what it really is, so an image sent as video_url is refused. Limits: images 30 MB, videos 50 MB, audio 15 MB. Ark asset:// ids are not supported.

Response

HTTP 200
{ "id": "cgt-3f0c2a9e-5b1d-4c47-9a2e-0d6f1b7c8e21" }

# header: x-nsfwai-credits: 60   (credits charged for this task)

Send an Idempotency-Key header to make retries safe: the same value from the same key returns the task it created the first time, without a second charge.

Retrieve a task

GEThttps://api.nsfwai.tv/api/v3/contents/generations/tasks/{id}

Returns the task object. The x-nsfwai-credits header carries what the task cost so far (after any refund).

statusMeaning
queuedWaiting: the task, or its reference files, have not reached the model yet.
runningThe model is making the video.
succeededDone: content.video_url (and content.last_frame_url if asked for).
failedSee error.code and error.message. Refunded.
cancelledCancelled while queued. Refunded.
expiredNot finished within execution_expires_after. Refunded.
{
  "id": "cgt-3f0c2a9e-5b1d-4c47-9a2e-0d6f1b7c8e21",
  "model": "doubao-seedance-2-0-mini-260615",
  "status": "succeeded",
  "content": {
    "video_url": "https://…/works/…/3f0c2a9e-5b1d-4c47-9a2e-0d6f1b7c8e21.mp4",
    "last_frame_url": "https://…/works/…/3f0c2a9e-5b1d-4c47-9a2e-0d6f1b7c8e21-last.jpg"
  },
  "usage": { "completion_tokens": 40594, "total_tokens": 40594 },
  "created_at": 1795764356,
  "updated_at": 1795764437,
  "seed": 28708,
  "resolution": "480p",
  "ratio": "9:16",
  "duration": 5,
  "framespersecond": 24,
  "generate_audio": true,
  "draft": false,
  "service_tier": "default",
  "execution_expires_after": 172800,
  "priority": 0,
  "output_format": "mp4"
}
  • duration is the requested length, or for -1 the real length once the video is done.
  • usage and seed are what the model reported.
  • created_at and updated_at are Unix seconds.

List tasks

GEThttps://api.nsfwai.tv/api/v3/contents/generations/tasks

Your account's API video tasks, newest first, from all its keys.

QueryNotes
page_numFrom 1. Default 1.
page_size1–500. Default 10.
filter.statusOne status, e.g. succeeded.
filter.task_idsRepeat it, or separate ids with commas.
filter.modelAny name of a model.
cURL
curl "https://api.nsfwai.tv/api/v3/contents/generations/tasks?page_num=1&page_size=10&filter.status=succeeded" \
  -H "Authorization: Bearer $NSFWAI_API_KEY"

# → { "items": [ { …task… }, … ], "total": 42 }

Cancel or delete a task

DELETEhttps://api.nsfwai.tv/api/v3/contents/generations/tasks/{id}
  • Queued: cancelled (status cancelled) and refunded.
  • Succeeded, failed, cancelled or expired: deleted, with its video and last frame. Retrieving it then returns 404.
  • Running: cannot be cancelled or deleted: 409 InvalidAction.TaskRunning. Try again when it has finished.
cURL
curl -X DELETE https://api.nsfwai.tv/api/v3/contents/generations/tasks/cgt-3f0c2a9e-5b1d-4c47-9a2e-0d6f1b7c8e21 \
  -H "Authorization: Bearer $NSFWAI_API_KEY"

# → {}

Callbacks

With callback_url set, we POST the task object (the same JSON as Retrieve) to it each time the status changes: queued, running, succeeded, failed,cancelled, expired.

  • Answer with any 2xx. Otherwise we retry after 10 s, 1 min and 5 min, then stop; the task itself is not affected.
  • Deliveries can arrive more than once or late: use the task id and its status, and retrieve the task if in doubt.
  • Only public http(s) URLs are called.

Checking the signature

Every callback carries X-NSFWAI-Signature: t=<unix seconds>,v1=<hex>, where v1 is the HMAC-SHA256 of "<t>.<raw body>" with your callback secret. The secret is shown in the API section of your account page. Compute it over the body exactly as received, before parsing it.

import hashlib, hmac, time

def verify(raw_body: bytes, header: str, secret: str, tolerance: int = 300) -> bool:
    """header = request.headers["X-NSFWAI-Signature"], raw_body = the bytes as received"""
    parts = dict(p.split("=", 1) for p in header.split(",") if "=" in p)
    t, sig = parts.get("t"), parts.get("v1")
    if not t or not sig or abs(time.time() - int(t)) > tolerance:
        return False
    expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, sig)

Errors

Errors use the Ark shape:

Example
HTTP/1.1 400 Bad Request

{
  "error": {
    "code": "InvalidParameter",
    "message": "Unsupported duration for doubao-seedance-2-0-mini-260615.",
    "param": "duration",
    "type": "BadRequest"
  }
}
HTTPcodeWhen
400InvalidParameter, MissingParameterA field is missing, unsupported or out of range; param names it. A file that cannot be downloaded or is not what it says.
401AuthenticationErrorNo key, or the key is wrong or deleted.
402InsufficientCreditsNot enough credits for the task. Nothing is charged.
403AccessDeniedThe API is not turned on for the account (turn it on on the account page), or it was turned off.
404InvalidEndpointOrModel.NotFoundUnknown model name.
404ResourceNotFoundNo such task on this account.
409InvalidAction.TaskRunningCancel or delete on a running task.
429RateLimitExceededToo many requests, or too many tasks at once. See Limits.

When the model provider turns a task down after it was accepted (for exampleOutputVideoSensitiveContentDetected.PolicyViolation), the task ends as failed with the provider's code and message in error, and its credits come back.

Limits

WhatLimit
Requests per key120 per minute
Tasks queued or running at once, per key10
Keys per account5
Prompt5,000 characters
Reference filesImages 30 MB, videos 50 MB, audio 15 MB; counts per model under Models

Over a limit you get 429 RateLimitExceeded; wait and retry.

Files

  • Result videos and last frames are hosted by NSFWAI.tv; content links point to our storage, not the provider's.
  • They are kept for at least 7 days. Download what you want to keep.
  • Reference files you send are stored with the task for the same time.

Differences from Ark

  • Base URL and key are ours; the request and response formats are Ark's.
  • Not supported: draft mode and draft_task content, tools, asset:// file ids. They return 400 InvalidParameter.
  • watermark is accepted but ignored: videos are never watermarked.
  • Task ids look like Ark's (cgt-…) but are ours; use them only with this API.
  • Prices are in NSFWAI.tv credits; the x-nsfwai-credits header says what a task costs.

Images · Seedream Coming soon

Seedream 5.5 in the Ark image format: POST https://api.nsfwai.tv/api/v3/images/generations, synchronous, returning the images in the response. Prices under Models.

Qwen Image Coming soon

Qwen Image 2.1 in Alibaba DashScope's formats, for the DashScope and OpenAI SDKs:

  • DashScope, synchronous: POST https://api.nsfwai.tv/api/v1/services/aigc/multimodal-generation/generation
  • DashScope, asynchronous: POST …/api/v1/services/aigc/image-generation/generation with X-DashScope-Async: enable, then GET …/api/v1/tasks/{task_id}
  • OpenAI-compatible: POST https://api.nsfwai.tv/compatible-mode/v1/images/generations

Questions, or need a format we don't have yet? Write to [email protected].