Image and Video API Integration
Use OOMOL Fusion API from your backend to generate and edit images or create videos. Each provider retains its supported request and response formats. Support applies to selected models and operations, not every API offered by the provider.
Create an API key
Create a personal API key in OOMOL Console, then set the environment variable below in your backend runtime. Use this OOMOL key as the SDK apiKey or HTTP Bearer token; you do not need to put a provider key in these examples. Keep the key out of browser bundles, public repositories and logs.
export FUSION_API_TOKEN="<your-oomol-api-key>"
Choose an endpoint
The service origin is https://fusion-api.oomol.com. Use the complete Base URL for your provider below, including its version path. Do not substitute the Connector or ProjectConnector endpoint. Confirm that your intended model is available and check pricing before making a paid request.
| Provider | Base URL |
|---|---|
| OpenAI Images | https://fusion-api.oomol.com/v1/provider/openai/v1 |
| Seedream | https://fusion-api.oomol.com/v1/provider/seedream/api/v3 |
| Seedance | https://fusion-api.oomol.com/v1/provider/seedance/api/v3 |
| Wanx | https://fusion-api.oomol.com/v1/provider/wanx/api/v1 |
| Kling | https://fusion-api.oomol.com/v1/provider/kling/ |
| MiniMax | https://fusion-api.oomol.com/v1/provider/minimax/ |
Run an example
Install only the package needed for your provider. Save the corresponding example as example.ts and run it in a server-side TypeScript environment. The package versions below match the repository’s local compatibility tests; they do not promise compatibility with every SDK version. These examples perform real generation when valid credentials and an available endpoint are used.
OpenAI Images
Image generation and editing; no other OpenAI APIs.
npm install openai@7.23.0
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.FUSION_API_TOKEN,
baseURL: "https://fusion-api.oomol.com/v1/provider/openai/v1",
maxRetries: 0,
timeout: 1_080_000,
});
const result = await client.images.generate({
model: "gpt-image-2",
prompt: "A ceramic mug on a wooden table",
size: "1536x864",
quality: "medium",
});
console.log(result);
Seedream
Image generation, reference images and selected SSE output.
npm install @volcengine/ark-runtime@1.0.11
import { ArkRuntimeClient } from "@volcengine/ark-runtime";
const client = new ArkRuntimeClient({
apiKey: process.env.FUSION_API_TOKEN,
baseURL: "https://fusion-api.oomol.com/v1/provider/seedream/api/v3",
retryTimes: 0,
timeout: 125_000,
});
const result = await client.generateImages({
model: "doubao-seedream-5-0-260128",
prompt: "A ceramic mug on a wooden table",
size: "2K",
response_format: "url",
});
console.log(result);
Seedance
Video generation and task queries.
npm install @volcengine/ark-runtime@1.0.11
import { ArkRuntimeClient } from "@volcengine/ark-runtime";
const client = new ArkRuntimeClient({
apiKey: process.env.FUSION_API_TOKEN,
baseURL: "https://fusion-api.oomol.com/v1/provider/seedance/api/v3",
retryTimes: 0,
timeout: 125_000,
});
const task = await client.createContentGenerationTask({
model: "doubao-seedance-2-0-260128",
content: [{ type: "text", text: "A boat on the ocean" }],
duration: 5,
resolution: "720p",
});
const status = await client.getContentGenerationTask(task.id);
console.log(task.id, status);
Wanx
Video generation and task queries.
npm install dashscope-sdk-official@1.26.0
import { Configuration, VideoSynthesis } from "dashscope-sdk-official";
const client = new VideoSynthesis(new Configuration({
apiKey: process.env.FUSION_API_TOKEN,
basePath: "https://fusion-api.oomol.com/v1/provider/wanx/api/v1",
}));
const task = await client.asyncCall({
model: "wan3.0-video",
prompt: "A boat on the ocean",
resolution: "1080P",
duration: 5,
});
const status = await client.fetch(task.output.task_id);
console.log(task.output.task_id, status);
Kling
Video generation and task queries.
npm install ky@1.11.0
import ky from "ky";
const client = ky.create({
prefixUrl: "https://fusion-api.oomol.com/v1/provider/kling/",
headers: { Authorization: `Bearer ${process.env.FUSION_API_TOKEN}` },
retry: 0,
redirect: "error",
timeout: 30_000,
});
const task = await client.post("text-to-video/kling-3.0-turbo", {
json: {
prompt: "A boat on the ocean",
settings: { duration: 5, resolution: "720p", aspect_ratio: "16:9" },
},
}).json<{ data: { id: string } }>();
const status = await client.get("tasks", {
searchParams: { task_ids: task.data.id },
}).json();
console.log(task.data.id, status);
MiniMax
Video generation and task queries.
npm install ky@1.11.0
import ky from "ky";
const client = ky.create({
prefixUrl: "https://fusion-api.oomol.com/v1/provider/minimax/",
headers: { Authorization: `Bearer ${process.env.FUSION_API_TOKEN}` },
retry: 0,
redirect: "error",
timeout: 30_000,
});
const task = await client.post("v2/video_generation", {
json: {
model: "MiniMax-H3",
content: [{ type: "text", text: "A boat on the ocean" }],
duration: 5,
resolution: "768P",
ratio: "16:9",
},
}).json<{ task_id: string }>();
const status = await client.get(
`v2/query/video_generation/${encodeURIComponent(task.task_id)}`,
).json();
console.log(task.task_id, status);
Query video results
The video examples create a task and query it once. Save the returned task ID before continuing. A successful creation response means the task was accepted, not that a video is ready. Query the same task with the same OOMOL identity until the provider reports a terminal state. Space out queries; stop on success or failure and read the provider’s result or error fields. A failed status request does not prove that generation failed. Do not create another task to check progress.
Handle failures and retries
Check both HTTP errors and the returned task state. Authentication and balance checks can return gateway errors that differ from a provider’s error format. For authentication failures, check the OOMOL key; for permission or balance errors, check the account and billing. For invalid inputs, check the model, operation and parameter values. For rate limits, reduce concurrency and follow a retry hint when supplied.
Creation timeouts, disconnections and server errors can leave the result uncertain. Keep the task ID, request ID and error details, and query an existing task when possible. Do not automatically resend a generation request: that can create another paid task. OpenAI and Ark examples disable SDK retries; ky also disables retries and redirects. DashScope uses the tested SDK configuration. Apply an application-level wait budget without blindly resubmitting when it expires.
Files, streaming and response data
Uploads, reference media and streaming have provider-specific limits. The OpenAI example covers the Images API only; it does not enable chat, Responses or other OpenAI APIs. Seedream supports selected SSE operations, while the OpenAI image entry shown here is synchronous. For streamed output, receiving some events is not the same as receiving the completion event.
Use a separate client to download returned media URLs, without your OOMOL Authorization header. Do not assume media links are permanent. Disconnecting a client does not guarantee cancellation of a generation already accepted upstream. Consult support for unsupported operations or an uncertain generation result; include request/task IDs and omit secrets.
Return to the Image & Video APIs overview.