DeepAny API
Your app.
Our generation.
Create images, edits, repaints, face swaps and videos from your own app or website with one API key. Pay per job in credits you move into the key; volume pricing for businesses on request.
Start in two minutes.
Buy API credits on the pricing page, create a key under API access on your profile page, assign credits to it, and call the API with the key in the Authorization header. Usage, spend and jobs are on your API dashboard. Machine-readable spec: openapi.json. Using the API means you accept the API Terms.
curl -s https://api.deepany.ai/api/v1/jobs \
-H "Authorization: Bearer dak_..." \
-F service=image \
-F "prompt=a lighthouse at dusk, film still" \
-F aspect_ratio=16:9Base URL https://api.deepany.ai/api/v1. Every response is JSON; files come back as PNG or MP4 bytes. Send the key only in a header, never in the URL. Keys can be full or read-only, can expire after 30 to 365 days, and can be rotated without losing their balance.
For businesses and resellers. Outputs carry no watermark, every key has its own balance and usage history, and you can hold several keys per account. For volume pricing or a custom agreement, get in touch and mention the API.
Safe retries. Send an Idempotency-Key header (up to 128 characters) with POST /jobs; repeating the same key on the same API key returns the first job ("replayed": true) instead of starting and charging another.
Pricing.
API credits are a separate balance from Studio credits. Buy packs on the pricing page: $0.10 per credit, every pack size. Assign them to keys on your profile page. Credits are taken when a job starts and returned when it fails or is cancelled. Outputs carry no watermark.
| Service | API credits | What you get |
|---|---|---|
image | 1 (standard), 2 (anime), 3 (anime, high quality) | Text to image |
image-edit | 1 (standard) or 2 (detail) | Prompted edit of your image |
inpaint | 2 | Repaint a masked region |
face-swap | 2 | Photo face swap |
video | per second by resolution: 480p 2 ($0.20/s), 540p 2 ($0.20/s), 640p 3 ($0.30/s), 720p 4 ($0.40/s), 960p 6 ($0.60/s), 1080p 8 ($0.80/s); 5 to 15 s | Text to video or image to video |
API jobs run on their own pool of workers with no per-key concurrency cap; they queue in order and the job shows its queue position. Rate limits: 60 job starts per 10 minutes and 600 reads per minute per key. Revoking a key returns its unused credits.
Create a job.
POST /jobs as multipart/form-data, or JSON when there are no files.
| Field | Services | Values |
|---|---|---|
service | all | image, image-edit, inpaint, video, face-swap |
prompt | all but face-swap | 1 to 20,000 characters |
negative_prompt | image, image-edit, inpaint | optional |
style | image, inpaint | standard (default) or anime |
quality | image | low, medium, high (default) |
quality | image-edit | standard (default) or detail |
aspect_ratio | image, image-edit | 1:1 (default), 16:9, 9:16, 4:3, 3:2 |
aspect_ratio | video | 1:1, 2:3, 3:2, 3:4, 4:3, 9:16, 16:9 (default), 21:9 |
seed | image, video | integer; video accepts -1 for random |
duration | video | 5 to 15 seconds, default 5 |
resolution | video | 480p, 540p, 640p, 720p (default), 960p, 1080p |
mask_prompt | inpaint | what to repaint when no mask file is sent |
image (file) | image-edit, inpaint, face-swap, video | PNG, JPEG or WebP up to 25 MB (face swap: PNG); for video the optional start frame |
mask (file) | inpaint | PNG, white = repaint |
face (file) | face-swap | the face photo, PNG |
callback_url | all | optional https URL for a signed webhook when the job finishes |
The response is the job:
{"id":"…","service":"image","status":"queued","progress":null,
"credits":1,"usd":0.1,"error":null,"result_url":null}Errors are {"error":"message"} with 400 (bad request), 401 (bad key), 402 (not enough credits), 429 (rate limit) or 503 (no worker free right now, retry later).
Webhooks.
Add callback_url (https, public host) when you create a job and we POST the final job to it: events job.completed, job.failed, job.cancelled, job.expired. Each delivery carries X-DeepAny-Event, X-DeepAny-Delivery (the same id on every retry) and X-DeepAny-Signature: t=…,v1=…, where v1 is HMAC-SHA256 of t + "." + body with the webhook_secret shown once when the key is created or rotated. Answer 2xx within 10 seconds; failures are retried six times over about seven hours. Polling keeps working alongside. When a key drops below five more jobs like the one just started, the account owner gets one email a day and, if the job had a callback_url, a signed balance.low event with the key id, balance and threshold.
{"id":"…","type":"job.completed","created_at":"…",
"job":{"id":"job_…","status":"completed","credits":1,"result_url":"/api/v1/jobs/job_…/result"}}Poll and download.
GET /jobs/{id}:statusisqueued,processing,completed,failed,cancelledorexpired. Poll every 2 to 5 seconds.GET /jobs/{id}/result: the PNG or MP4 once completed; 409 before that. Image results stay available for about 6 hours.POST /jobs/{id}/cancel: asks the worker to stop. A job that already finished stays completed and charged.GET /jobs?limit=50: your recent jobs.GET /me: the key's label, balance and USD value.
The same content rules as the Studio apply. A job the worker refuses fails immediately with the reason and is not charged. Questions: get in touch.
Code samples.
Create an image, wait for it and save the file. Replace dak_... with your key.
Python (requests)
import time, requests
API = "https://api.deepany.ai/api/v1"
H = {"Authorization": "Bearer dak_..."}
job = requests.post(f"{API}/jobs", headers={**H, "Idempotency-Key": "order-42"},
data={"service": "image", "prompt": "a lighthouse at dusk", "aspect_ratio": "16:9"}).json()
while job["status"] not in ("completed", "failed", "cancelled", "expired"):
time.sleep(3)
job = requests.get(f"{API}/jobs/{job['id']}", headers=H).json()
if job["status"] == "completed":
open("lighthouse.png", "wb").write(requests.get(f"{API}{job['result_url']}", headers=H).content)
else:
print("failed:", job["error"])Node.js (built-in fetch, Node 18+)
const API = "https://api.deepany.ai/api/v1", H = { Authorization: "Bearer dak_..." };
const form = new FormData();
form.set("service", "video"); form.set("prompt", "waves at sunrise"); form.set("duration", "5"); form.set("resolution", "720p");
form.set("image", new Blob([await fs.promises.readFile("start.jpg")]), "start.jpg"); // optional start frame
let job = await (await fetch(`${API}/jobs`, { method: "POST", headers: H, body: form })).json();
while (!["completed", "failed", "cancelled", "expired"].includes(job.status)) {
await new Promise(r => setTimeout(r, 5000));
job = await (await fetch(`${API}/jobs/${job.id}`, { headers: H })).json();
}
if (job.status === "completed") await fs.promises.writeFile("waves.mp4", Buffer.from(await (await fetch(API + job.result_url, { headers: H })).arrayBuffer()));Verify a webhook (Node.js)
import crypto from "node:crypto";
function verify(rawBody, header, secret) { // header = req.headers["x-deepany-signature"]
const t = /t=(\d+)/.exec(header)?.[1], v1 = /v1=([a-f0-9]+)/.exec(header)?.[1];
const expected = crypto.createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
return !!t && !!v1 && Math.abs(Date.now() / 1000 - Number(t)) < 300 && crypto.timingSafeEqual(Buffer.from(v1), Buffer.from(expected));
}Connected workflows