Skip to main content

Platform-native generation

Besides the OpenAI-compatible endpoints, FunAI has platform-native endpoints for every kind of output: image, video, audio, text and 3D. Use them for anything the OpenAI shape does not cover, such as video, image editing, music or long jobs.

All paths are under https://api.funai.art/generation/v1.

Generate​

Endpoint: POST /generation/v1/generate

import httpx

API_KEY = "YOUR_FUNAI_API_KEY"
URL = "https://api.funai.art/generation/v1/generate"

payload = {
"model_id": "flux-schnell",
"workflow": "text_to_image",
"prompt": "A lighthouse on a cliff at dawn, watercolour",
"is_async": True,
}

headers = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}

job = httpx.post(URL, json=payload, headers=headers, timeout=60).json()
print(job["job_id"], job["status"])

Main request fields​

FieldTypeDescription
model_idstringRequired. FunAI model ID, e.g. flux-schnell. See Models.
workflowstringWhat to make: text_to_image, image_to_image, text_to_video, image_to_video, text_to_audio, audio_to_audio, text_to_3d, image_to_3d, and so on. Must be one the model supports.
promptstringThe prompt.
negative_promptstringOptional.
durationnumberVideo/audio length in seconds, where the model supports it.
width, heightintegerOutput size for image models that take pixel sizes.
seedintegerOptional, for repeatable results where supported.
custom_paramsobjectModel-specific options (voice, aspect ratio, input image URLs and so on). The model reference lists them per model.
is_asyncbooleantrue returns a job straight away for you to poll. Use it for video, audio and 3D. Default false.

Response​

FieldDescription
job_idID to poll.
statusCOMPLETED, PROCESSING or FAILED.
output_urlThe result, once COMPLETED.
poll_url, poll_intervalWhere and how often to poll an async job.
error_code, messageSet when the job failed.

Per-media endpoints​

These take the same body but only accept models of that kind:

MethodPathAccepts
POST/generation/v1/generate/imageimage models
POST/generation/v1/generate/videovideo models
POST/generation/v1/generate/audioaudio models
POST/generation/v1/generate/texttext models
POST/generation/v1/generate/3d3D models

Job status​

Endpoint: GET /generation/v1/jobs/{job_id}/status

status = httpx.get(
f"https://api.funai.art/generation/v1/jobs/{job_id}/status",
headers=headers,
).json()
print(status["status"], status.get("output_url"))

Poll every few seconds until status is COMPLETED or FAILED, or use webhooks instead of polling.

Which API to use​

  • OpenAI-compatible (/v1/chat/completions, /v1/images/generations): when you already use an OpenAI SDK or a tool that expects the OpenAI format.
  • Platform-native (/generation/v1/generate and the per-media endpoints): for video, audio, 3D, image editing and model-specific options.