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
| Field | Type | Description |
|---|---|---|
model_id | string | Required. FunAI model ID, e.g. flux-schnell. See Models. |
workflow | string | What 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. |
prompt | string | The prompt. |
negative_prompt | string | Optional. |
duration | number | Video/audio length in seconds, where the model supports it. |
width, height | integer | Output size for image models that take pixel sizes. |
seed | integer | Optional, for repeatable results where supported. |
custom_params | object | Model-specific options (voice, aspect ratio, input image URLs and so on). The model reference lists them per model. |
is_async | boolean | true returns a job straight away for you to poll. Use it for video, audio and 3D. Default false. |
Response
| Field | Description |
|---|---|
job_id | ID to poll. |
status | COMPLETED, PROCESSING or FAILED. |
output_url | The result, once COMPLETED. |
poll_url, poll_interval | Where and how often to poll an async job. |
error_code, message | Set when the job failed. |
Per-media endpoints
These take the same body but only accept models of that kind:
| Method | Path | Accepts |
|---|---|---|
POST | /generation/v1/generate/image | image models |
POST | /generation/v1/generate/video | video models |
POST | /generation/v1/generate/audio | audio models |
POST | /generation/v1/generate/text | text models |
POST | /generation/v1/generate/3d | 3D 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/generateand the per-media endpoints): for video, audio, 3D, image editing and model-specific options.