Developer Reference

API Documentation

Build production-ready integrations with FunPhantom. Generate video, edits, and audio-synced clips from a single, well-documented API.

FunPhantom API Documentation

Domain: https://nsfw.funphantom.in/api/

Authentication: Single X-API-Key header on every request.

Catalog: Full template list on this host. API generation does not filter prompts.


Table of Contents

  1. Getting Started
  2. Authentication
  3. Rate Limits
  4. Common Headers & Response Format
  5. Error Codes
  6. User Endpoints
  7. Template & Catalog Endpoints
  8. Generation Endpoints
  9. Job Status & Management
  10. Delete Endpoints
  11. Catalog & Domain Notes
  12. Code Examples
  13. FAQ

1. Getting Started

1.1 What You Can Do

The FunPhantom API exposes the same generation capabilities available on the website:

  • Video Generation (WAN 2.2): Image-to-video from an input photo
  • Video + Audio (LTX): Text-to-video or image-to-video with synced audio
  • MiniMax H3: Text-to-video, image-to-video, and reference-to-video
  • Wan 3.0 Ref2V: Reference-to-video (1–5 images) with optional audio / prompt expansion
  • Image Generation (T2I): Flux text-to-image
  • Image Edit: Blend/edit images using base64 inputs
  • Image Inpaint: Mask-based inpainting
  • Faceswap: Face swap onto a target image (Pro subscription required)
  • Job Management: Submit jobs, poll status, list jobs, delete jobs, reuse settings
  • Template Catalogs: LoRA video templates, image models, image-edit templates, H3 R2V templates
  • Admin: Register templates via POST /api/templates and POST /api/h3-r2v-templates (boss accounts)

1.2 Request Flow

  1. Authenticate with X-API-Key: fp_your_key on every request.
  2. For POST endpoints, send Content-Type: application/json with your parameters and base64-encoded images.
  3. Receive a job_id in the submit response.
  4. Poll GET /api/job/{job_id} every 5–10 seconds until status is COMPLETED or FAILED.

Status reads are database-only — the API does not call RunPod on your behalf. A background worker handles processing and billing.


2. Authentication

2.1 API Key Format

Your API key is a single opaque token:

X-API-Key: fp_AbCdEfGhIjKlMnOpQrStUvWxYz0123456789abc

Send it in the X-API-Key header on every request. There is no second secret and no request signing (HMAC).

2.2 Obtaining an API Key

API keys are generated from the FunPhantom dashboard under Account → API Keys. You will only see the full key once at creation — save it immediately.

2.3 Using Your Key

Python Example

import requests

API_KEY = "fp_your_api_key_here"
BASE_URL = "https://nsfw.funphantom.in/api"

HEADERS = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json"
}

# GET request
r = requests.get(f"{BASE_URL}/user/info", headers=HEADERS)
print(r.json())

# POST request
payload = {
    "prompt": "a cinematic video",
    "image_base64": "data:image/jpeg;base64,...",
    "duration": 6
}
r = requests.post(f"{BASE_URL}/generate/video", headers=HEADERS, json=payload)
print(r.json())

JavaScript Example

const API_KEY = 'fp_your_api_key_here';
const BASE_URL = 'https://nsfw.funphantom.in/api';

const headers = {
  'X-API-Key': API_KEY,
  'Content-Type': 'application/json'
};

const payload = { prompt: 'a cinematic video', image_base64: 'data:image/jpeg;base64,...', duration: 6 };
const resp = await fetch(`${BASE_URL}/generate/video`, { method: 'POST', headers, body: JSON.stringify(payload) });
console.log(await resp.json());

2.4 Important Notes

  • All requests (GET and POST) require X-API-Key.
  • Never embed your API key in client-side code or public repositories.
  • Keys can be deleted and rotated from the API Dashboard.

3. Rate Limits

Rate limits are enforced per IP and per API key:

Endpoint Group Limit
User read (/user/*, /templates, catalogs) 120 / 60 s
Job status / list (/job/*, /jobs, /stats) 120 / 60 s
Video generation (/generate/video) 20 / 60 s
Video + Audio, MiniMax H3 60 / 60 s
Wan 3.0 Ref2V 30 / 60 s
Image generation, image edit, inpaint 30 / 60 s
Faceswap 20 / 60 s
Delete endpoints 20 / 60 s
Template registration (boss) 10 / 60 s

When exceeded:

{
  "error": "Too many requests. Please slow down.",
  "code": 429
}

4. Common Headers & Response Format

4.1 Required Headers

Header Value Required
X-API-Key Your fp_… token Always
Content-Type application/json POST / PUT / PATCH

4.2 Submit Response Format

Generation endpoints return a JSON object like:

{
  "job_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "submitted",
  "message": "Video generation started successfully (1.2 tokens used)",
  "token_cost": 1.2,
  "remaining_tokens": 48.8
}

Some endpoints add type-specific fields (see §8).

4.3 Base64 Image Format

Images may be sent as:

  • Raw base64 string
  • Data URI: data:image/jpeg;base64,/9j/4AAQ…
  • Public HTTPS URL (where supported)

5. Error Codes

All errors return JSON:

{
  "error": "Human-readable message",
  "code": 400
}
HTTP Meaning
400 Invalid request / validation error
401 Missing or invalid API key
402 Insufficient tokens
403 Subscription required (e.g. premium LoRA, faceswap)
404 Resource not found
429 Rate limit or concurrent job slot exceeded
500 Server / RunPod submission error
503 Service maintenance (e.g. MiniMax H3 disabled)

6. User Endpoints

6.1 GET /api/user/info

Returns the authenticated user's profile.

Response:

{
  "id": 42,
  "email": "[email protected]",
  "username": "myuser",
  "first_name": "Jane",
  "last_name": "Doe",
  "tokens": 48.8,
  "subscription_active": true,
  "subscription_end": "2026-12-31T00:00:00",
  "created_at": "2025-06-01T10:00:00"
}

Internal fields (is_boss, password_hash, OAuth tokens) are never exposed.

6.2 GET /api/user/balance

Response:

{
  "tokens": 48.8,
  "subscription_active": true,
  "subscription_end": "2026-12-31T00:00:00",
  "can_generate": true
}

6.3 GET /api/user/tokens

Response:

{
  "tokens": 48.8,
  "total_tokens_used": 152.3,
  "subscription_active": true
}

7. Template & Catalog Endpoints

7.1 GET /api/templates

List WAN 2.2 LoRA / video templates. Alias: GET /api/lora-templates.

On this host, the catalog is unfiltered (is_mature flags are returned as stored).

Response:

{
  "templates": {
    "blink_missionary": {
      "id": "blink_missionary",
      "name": "Blink Missionary",
      "category": "Dance",
      "subcategory": null,
      "is_mature": false,
      "usage_count": 152,
      "release_date": "2025-01-15",
      "is_new": false,
      "is_featured": true,
      "prompt": "A woman dancing…",
      "negative_prompt": "blurry, low quality…",
      "description": "Short description for UI",
      "hint": "Upload a clear full-body photo",
      "sub_templates": [
        {
          "id": "close_up",
          "name": "Close-up",
          "prompt": "Close-up variation prompt…",
          "negative_prompt": "…"
        }
      ]
    }
  },
  "count": 58
}

Boss-only: GET /api/templates?full=1 returns raw template JSON plus a categories object.

7.2 POST /api/templates (Boss only)

Create or overwrite a LoRA template JSON file.

Request:

{
  "id": "my_template",
  "name": "My Template",
  "prompt": "…",
  "negative_prompt": "…",
  "category": "Custom",
  "is_mature": true
}

Response:

{
  "success": true,
  "template_id": "my_template",
  "message": "Template created successfully"
}

7.3 GET /api/image-models

Response:

{
  "success": true,
  "models": {
    "flux_dev": {
      "id": "flux_dev",
      "name": "Flux Dev",
      "description": "Default Flux model",
      "type": "image",
      "has_lora": false
    }
  }
}

7.4 GET /api/image-edit-templates

Returns the full image-edit template list on this host.

Response:

{
  "success": true,
  "templates": {
    "oil_painting": {
      "id": "oil_painting",
      "name": "Oil Painting",
      "category": "Style",
      "description": "Transform into oil painting",
      "requires_second_image": false,
      "usage_count": 89
    }
  }
}

7.5 GET /api/h3-r2v-templates

MiniMax H3 reference-to-video template catalog.

Query params: sort (latest | most-used | free-first | name), id (single template).

List response:

{
  "templates": {
    "cinematic_walk": {
      "id": "cinematic_walk",
      "name": "Cinematic Walk",
      "category": "Motion",
      "prompt": "…",
      "usage_count": 34
    }
  },
  "categories": ["Motion", "Dance"],
  "sort": "latest",
  "pro_prompt_lock_enabled": false
}

7.6 POST /api/h3-r2v-templates (Boss only)

Register an H3 R2V template. Requires id, name, is_mature, and release_date (YYYY-MM-DD).


8. Generation Endpoints

8.1 POST /api/generate/video

Alias: POST /api/generate

Image-to-video (WAN 2.2).

Field Type Required Description
image_base64 string Yes Input photo
prompt string Yes* Text prompt (*optional if lora_template provided)
lora_template string No Template ID from /templates
sub_template string No Sub-template ID
orientation string No portrait (default), landscape, square
duration int No 3–8 seconds (default 6)
steps int No 4, 6, or 8 (default 4)
cfg float No Default 1.0
seed int No ≥0 fixed; -1 random
negative_prompt string No Override template negative
video_quality string No legacy or new
end_image_base64 string No End frame (only with video_quality: "new")
result_type string No url (default) or base64
auto_upscale bool No Auto upscale on completion
platform string No Partner tracking label
in_app_username string No End-user identifier for analytics

Submit response:

{
  "job_id": "uuid",
  "status": "submitted",
  "message": "Video generation started successfully (1.2 tokens used)",
  "token_cost": 1.2,
  "remaining_tokens": 47.6,
  "result_type": "url",
  "video_quality": "legacy"
}

8.2 POST /api/generate/video-audio

Alias: POST /api/video-audio/generate

Uses this host’s video+audio RunPod endpoint automatically based on request host.

Field Type Required Description
prompt string Yes Text prompt
duration int No 5–20 seconds (default 5)
width / height int No 64–1240, multiples of 8
image_base64 string No If set → I2V mode
template string No Template ID
negative_prompt string No Override negative prompt
frame_rate int No 16 or 25

Submit response:

{
  "job_id": "uuid",
  "status": "submitted",
  "message": "Video+Audio generation started (4.5 tokens used)",
  "token_cost": 4.5,
  "remaining_tokens": 43.1,
  "mode": "I2V"
}

8.3 POST /api/generate/image-edit

Field Type Required Description
image_1_base64 string Yes Primary image
prompt string Yes* Edit prompt
image_2_base64 string No Secondary image
image_3_base64 string No Third image (Ultra only)
template_id string No From /image-edit-templates
model string No qwen or flux
version string No v2 (default)
v2_mode string No fast or quality

Submit response:

{
  "job_id": "uuid",
  "status": "submitted",
  "token_cost": 0.5,
  "remaining_tokens": 42.6
}

8.4 POST /api/generate/image

Field Type Required Description
prompt string Yes Text prompt
model string No Model ID
lora_template string No LoRA from /image-models
width / height int No Max 2048
guidance float No Default 7.5
seed int No -1 for random
num_inference_steps int No Default 4

Submit response:

{
  "job_id": "uuid",
  "status": "submitted",
  "token_cost": 0.4,
  "remaining_tokens": 42.2
}

8.5 POST /api/generate/minimax-h3

Aliases: POST /api/minimax-h3/generate

See primary-domain documentation §8.5 for full field table. This host uses its configured H3 endpoints.

template_id works with mode=r2v (recommended, 1–4 refs) or mode=i2v (one image_base64; server prepends identity preamble + style LoRAs). Omitting mode with a template defaults to R2V. Post-deploy smoke checklist: docs/H3_TEMPLATE_I2V_SMOKE.md.

Submit response:

{
  "job_id": "uuid",
  "status": "submitted",
  "message": "MiniMax H3 R2V generation started (8.0 tokens reserved)",
  "pre_token_cost": 8.0,
  "token_cost": 8.0,
  "remaining_tokens": 34.2,
  "mode": "r2v",
  "reference_count": 2
}

8.5b POST /api/generate/wan3-ref2v

Aliases: POST /api/wan3-ref2v/generate

Wan 3.0 Reference-to-Video. Requires an active Pro subscription on the API account. Fixed token billing from size × duration (audio and prompt expansion are free).

Field Type Required Description
prompt string Yes Motion / scene prompt (up to ~20k chars)
images array Yes* 1–5 reference images as data-URIs or base64 (image/jpeg / image/png)
duration int No 2–30 seconds (default 5; Pro/Ultra/API up to 30)
size string No 480p, 720p (default), 1080p
aspect_ratio string No 16:9, 9:16, 1:1, 4:3, 3:4 (default 16:9)
audio_enable bool No Generate synced audio (default false; no extra tokens). Independent of audios.
audios array No 0–3 reference audio files as data-URIs or base64 (audio/mpeg, audio/wav, audio/mp4 M4A, audio/aac, audio/ogg). Max 8 MB and 10 seconds each. Combined duration of all files must be 15 seconds or less. Video is rejected. Omit the field when unused (do not send []). Not lip-sync; no extra tokens.
prompt_expansion_enable bool No Expand prompt server-side (default false; no extra tokens)
seed int No -1 for random
platform string No api (default), web, telegram, kn
in_app_username string No Partner end-user label (shown in FunPhantom admin)
result_type string No url or base64 (partners should use base64 for rehosting)

*Multipart uploads with image files are also accepted on this endpoint. Multipart audio: audio_1audio_3 or audios[].

Token formula: tokens = max(2, round(duration × rate[size], 2))
Default rates: 480p 0.88/s · 720p 1.76/s · 1080p 3.52/s. Optional admin discount: job_discounts.wan3_ref2v. Reference audio does not change this formula.

Examples (0% discount): 5s @ 720p = 8 tokens · 10s @ 1080p = 32 tokens · 15s @ 480p = 12 tokens · 30s @ 720p = 48 tokens.

Submit response:

{
  "job_id": "uuid",
  "status": "submitted",
  "message": "Wan 3.0 Ref2V generation started (8.0 tokens used)",
  "token_cost": 8.0,
  "remaining_tokens": 40.0,
  "status_url": "https://nsfw.funphantom.in/wan3-ref2v-job/uuid"
}

Poll: GET /api/wan3-ref2v-jobs/{id} (alias: GET /api/wan3-ref2v/job/{id})

When COMPLETED, the status payload includes:

  • video_url — API-key download URL (/api/wan3-ref2v/{id}/video)
  • video_base64data:video/mp4;base64,… for partner rehosting (preferred)

Do not use the browser page /wan3-ref2v/{id} for API downloads — it requires a login session.

Download: GET /api/wan3-ref2v/{id}/video (alias: GET /api/wan3-ref2v-jobs/{id}/video) with X-API-Key.

8.5c POST /api/generate/seedream-i2i

Seedream 5.0 Pro image edit. Requires Pro subscription. Multipart or JSON images (1–5, 4 MB each). size must be an exact enum. output_format jpg|png. Tokens: round(usd × 27, 2) (default 1.22). Poll GET /api/seedream-jobs/{id}; image GET /api/seedream-jobs/{id}/image.

8.5d POST /api/generate/seedream-ref2i

Seedream 4.5 reference-to-image. 2K sizes only. No output_format. Default 1.08 tokens.

8.6 POST /api/generate/faceswap

Requires active Pro subscription.

Field Type Required Description
target_base64 string Yes Body/target (alias: body_base64)
source_base64 string Yes Face/source (alias: face_base64)

Submit response:

{
  "job_id": "uuid",
  "status": "submitted",
  "token_cost": 1.0,
  "remaining_tokens": 33.2,
  "status_url": "https://nsfw.funphantom.in/api/faceswap/uuid"
}

8.7 POST /api/encode/image-mask

Same as primary-domain docs §8.7.

8.8 POST /api/generate/image-inpaint

Same as primary-domain docs §8.8.


9. Job Status & Management

9.1 GET /api/job/{id}

Aliases: GET /api/job/{id}/status, GET /api/video-audio/job/{id}

Database-only status — poll every 5–10 s.

Common fields: job_id, type, status, progress, timestamps, error_message, token_cost.

Supported type values: video, video_audio, minimax_h3, image, image_edit, faceswap.

type: video (completed)

{
  "job_id": "uuid",
  "type": "video",
  "status": "COMPLETED",
  "progress": 100,
  "token_cost": 1.2,
  "video_url": "https://nsfw.funphantom.in/video/uuid",
  "result_urls": ["https://nsfw.funphantom.in/video/uuid"]
}

type: minimax_h3 (completed)

{
  "job_id": "uuid",
  "type": "minimax_h3",
  "status": "COMPLETED",
  "mode": "r2v",
  "duration": 8,
  "megapixels": 0.8,
  "pre_token_cost": 8.0,
  "token_cost": 7.5,
  "execution_time_ms": 198000,
  "billing_adjusted": true,
  "video_url": "https://nsfw.funphantom.in/minimax-h3/uuid",
  "video_base64": "data:video/mp4;base64,…"
}

See primary-domain documentation §9 for complete per-type field reference.

9.2 GET /api/minimax-h3-jobs/{id}

Dedicated H3 status endpoint.

9.2b GET /api/wan3-ref2v-jobs/{id}

Aliases: GET /api/wan3-ref2v/job/{id}

{
  "id": "uuid",
  "status": "COMPLETED",
  "duration": 5,
  "size": "720p",
  "aspect_ratio": "9:16",
  "audio_enable": true,
  "prompt_expansion_enable": false,
  "pre_token_cost": 8.0,
  "token_cost": 8.0,
  "video_url": "https://nsfw.funphantom.in/api/wan3-ref2v/uuid/video",
  "video_base64": "data:video/mp4;base64,…"
}

9.3 GET /api/faceswap/{id}

{
  "job_id": "uuid",
  "status": "COMPLETED",
  "token_cost": 1.0,
  "image_url": "https://nsfw.funphantom.in/faceswap/uuid/image",
  "image_base64": "data:image/jpeg;base64,…"
}

9.4 GET /api/jobs

{
  "jobs": [
    {
      "id": "uuid",
      "type": "video_audio",
      "status": "IN_PROGRESS",
      "created_at": "2026-09-01T12:00:00",
      "token_cost": 4.5,
      "mode": "I2V"
    }
  ],
  "pagination": {
    "page": 1,
    "pages": 2,
    "per_page": 20,
    "total": 28,
    "has_next": true,
    "has_prev": false
  }
}

9.5 GET /api/stats

{
  "total_jobs": 200,
  "completed_jobs": 175,
  "failed_jobs": 8,
  "pending_jobs": 17,
  "success_rate": 87.5,
  "tokens_remaining": 55.0,
  "subscription_active": true,
  "breakdown": {
    "video": { "total": 120, "completed": 105, "failed": 5, "pending": 10 },
    "video_audio": { "total": 80, "completed": 70, "failed": 3, "pending": 7 }
  }
}

9.6 GET /api/jobs/{id}/settings

Video job reuse settings — same shape as primary-domain docs §9.6.


10. Delete Endpoints

Method Path Description
DELETE /api/jobs/delete-all Delete all user's jobs
DELETE /api/jobs/{id} Delete video job
DELETE /api/jobs/delete/{id} Delete video job (alias)
DELETE /api/image-jobs/delete/{id} Delete T2I job
DELETE /api/image-edit-jobs/delete/{id} Delete image edit job
DELETE /api/faceswap-jobs/delete/{id} Delete faceswap job
DELETE /api/video-audio-jobs/delete/{id} Delete video+audio job
DELETE /api/minimax-h3-jobs/delete/{id} Delete H3 job
DELETE /api/wan3-ref2v-jobs/delete/{id} Delete Wan 3.0 job
DELETE /api/image-upscale-jobs/delete/{id} Delete upscale job

11. Catalog & Domain Notes

  • API generation does not filter prompts on any domain.
  • GET /templates and related catalogs on this host return the full list (is_mature as stored).
  • Jobs may carry an is_mature flag for internal analytics only.
  • Video+Audio jobs on this host use this domain’s RunPod routing.

12. Code Examples

import time, requests

API_KEY = "fp_…"
BASE = "https://nsfw.funphantom.in/api"
H = {"X-API-Key": API_KEY, "Content-Type": "application/json"}

# List full template catalog
templates = requests.get(f"{BASE}/templates", headers=H).json()
print(f"{templates['count']} templates available")

# Generate with a template
with open("photo.jpg", "rb") as f:
    import base64
    b64 = "data:image/jpeg;base64," + base64.b64encode(f.read()).decode()

r = requests.post(f"{BASE}/generate/video", headers=H, json={
    "image_base64": b64,
    "lora_template": "your_template_id",
    "duration": 6
})
job_id = r.json()["job_id"]

while True:
    s = requests.get(f"{BASE}/job/{job_id}", headers=H).json()
    if s["status"] in ("COMPLETED", "FAILED"):
        print(s.get("video_url") or s.get("error_message"))
        break
    time.sleep(8)

13. FAQ

Does the API use HMAC signing? No. Only X-API-Key is required.

Does status polling call RunPod? No. A background worker updates job state.

Are Flow pipeline or standalone upscale available via API? No — web-session features only.

What's the difference from funphantom.in? Full template catalog on this host, domain-specific video+audio RunPod routing, and no catalog filtering.

AI-Generated Content Disclaimer:

Visuals on FunPhantom are AI-generated. Do not upload images of real people without their consent. Users are responsible for generated content. FunPhantom is not KN FunPhantom.

FunPhantom

Professional AI video generation platform

© 2025 FunPhantom. All rights reserved.

Secure Payment via Razorpay