flux-2-dev/text-to-image
flux-2-dev/text-to-image
Black Forest Labs 推出的 FLUX.2 [dev] 提供快速、影棚级质量的文生图生成,具备更强的真实感、更清晰的文字渲染和原生编辑能力,便于快速迭代。开箱即用的 REST 推理 API,性能出色,无冷启动,价格实惠。
示例
参数
| 名称 | 类型 | 默认 | 约束 | 说明 |
|---|---|---|---|---|
| prompt *提示词 | textarea | — | ≤ 5000 chars | 用于生成的正向提示词。 |
| size尺寸 | text | 1024*1024 | ≤ 500 chars | 生成媒体的像素尺寸(宽度*高度)。 |
| seed随机种子 | number | — | step 1 | 用于生成的随机种子。设为 -1 表示使用随机种子。 |
输出字段
| 字段 | 类型 | 说明 |
|---|---|---|
| images | array<string> |
API
通过统一 REST API 调用本模型;在 API Keys 页获取密钥。
cURL
# 1) Submit — returns { "task_uuid": "..." }
curl -X POST "https://www.namifusion.com/api/v1/marketplace/run/flux-2-dev/text-to-image" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"prompt": "A cinematic portrait of a young astronaut standing in a neon-lit greenhouse on Mars, ultra-realistic, detailed face, reflective visor helmet tucked under one arm, lush green plants contrasting with red Martian soil outside the glass dome, soft volumetric lighting, sharp focus, high detail, subtle text label on a nearby equipment case reading \"Ares Botany Lab\"",
"size": "1024*1024",
"seed": -1
}
}'
# 2) Poll until status is "completed", then read the output URLs
curl "https://www.namifusion.com/api/v1/marketplace/run/tasks/TASK_UUID" \
-H "Authorization: Bearer YOUR_API_KEY"Python
import time, requests
API_KEY = "YOUR_API_KEY"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
# 1) Submit
resp = requests.post(
"https://www.namifusion.com/api/v1/marketplace/run/flux-2-dev/text-to-image",
headers=HEADERS,
json={
"input": {
"prompt": "A cinematic portrait of a young astronaut standing in a neon-lit greenhouse on Mars, ultra-realistic, detailed face, reflective visor helmet tucked under one arm, lush green plants contrasting with red Martian soil outside the glass dome, soft volumetric lighting, sharp focus, high detail, subtle text label on a nearby equipment case reading \"Ares Botany Lab\"",
"size": "1024*1024",
"seed": -1
}
},
)
resp.raise_for_status() # 401/402/429/5xx stop here instead of polling a bad task
task = resp.json()
# 2) Poll until a terminal state (completed / failed / cancelled).
# This model is allowed up to 1800s server-side.
deadline = time.time() + 1860
while task.get("status") not in ("completed", "failed", "cancelled"):
if time.time() > deadline:
raise TimeoutError(f"still {task.get('status')} — keep the task_uuid and poll later")
time.sleep(3)
poll = requests.get(f"https://www.namifusion.com/api/v1/marketplace/run/tasks/{task['task_uuid']}", headers=HEADERS)
poll.raise_for_status()
task = poll.json()
print(task["status"], task.get("output"))JavaScript
const API_KEY = "YOUR_API_KEY";
const HEADERS = { Authorization: `Bearer ${API_KEY}` };
// 1) Submit
const resp = await fetch("https://www.namifusion.com/api/v1/marketplace/run/flux-2-dev/text-to-image", {
method: "POST",
headers: { ...HEADERS, "Content-Type": "application/json" },
body: JSON.stringify({
"input": {
"prompt": "A cinematic portrait of a young astronaut standing in a neon-lit greenhouse on Mars, ultra-realistic, detailed face, reflective visor helmet tucked under one arm, lush green plants contrasting with red Martian soil outside the glass dome, soft volumetric lighting, sharp focus, high detail, subtle text label on a nearby equipment case reading \"Ares Botany Lab\"",
"size": "1024*1024",
"seed": -1
}
}),
});
if (!resp.ok) throw new Error(`submit failed: ${resp.status} ${await resp.text()}`);
let task = await resp.json();
// 2) Poll until a terminal state (completed / failed / cancelled).
// This model is allowed up to 1800s server-side.
const deadline = Date.now() + 1860 * 1000;
while (!["completed", "failed", "cancelled"].includes(task.status)) {
if (Date.now() > deadline) throw new Error(`still ${task.status} — keep the task_uuid and poll later`);
await new Promise((r) => setTimeout(r, 3000));
const poll = await fetch(`https://www.namifusion.com/api/v1/marketplace/run/tasks/${task.task_uuid}`, { headers: HEADERS });
if (!poll.ok) throw new Error(`poll failed: ${poll.status}`);
task = await poll.json();
}
console.log(task.status, task.output);文档
flux-2-dev/text-to-image
flux-2-dev/text-to-image
Black Forest Labs 推出的 FLUX.2 [dev] 提供快速、影棚级质量的文生图生成,具备更强的真实感、更清晰的文字渲染和原生编辑能力,便于快速迭代。开箱即用的 REST 推理 API,性能出色,无冷启动,价格实惠。
参数
| 参数 | 类型 | 必填 | 默认值 | 范围/说明 |
|---|---|---|---|---|
prompt | string | 是 | — | max 5000 chars; 用于生成的正向提示词。 |
size | string | 否 | "1024*1024" | max 500 chars; 生成媒体的像素尺寸(宽度*高度)。 |
seed | integer | 否 | — | 用于生成的随机种子。设为 -1 表示使用随机种子。 |
价格
每张生成图片 $0.012,即 1.2 积分。本接口采用固定价格。
与 WaveSpeed 官方标准标价一致;1 美元 = 100 积分。账户折扣另行计算。
API
curl -X POST https://www.namifusion.com/api/v1/marketplace/run/flux-2-dev/text-to-image \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"input": {
"prompt": "A cinematic portrait of a young astronaut standing in a neon-lit greenhouse on Mars, ultra-realistic, detailed face, reflective visor helmet tucked under one arm, lush green plants contrasting with red Martian soil outside the glass dome, soft volumetric lighting, sharp focus, high detail, subtle text label on a nearby equipment case reading \"Ares Botany Lab\"",
"size": "1024*1024",
"seed": -1
}
}'
curl 'https://www.namifusion.com/api/v1/marketplace/run/tasks/TASK_UUID' \
-H "Authorization: Bearer $API_KEY"
提交后返回 task_uuid;轮询至 completed 或 failed。成功输出字段:output.images(URL 数组)。本 API 使用异步任务并返回 URL。
相关模型
z-image-spicy/text-to-image
从文本提示生成高质量图片,支持 256 至 1536 像素自定义尺寸、智能提示词扩写和随机种子,适合创意设计与批量出图。
xAI Grok Imagine Image v2.0 文生图
xAI Grok Imagine Image V2.0 文生图可根据文本提示词生成高质量图片,并支持配置宽高比、分辨率和质量,适用于创意视觉、社交内容、营销素材和生产工作流。提供开箱即用的 REST 推理 API,性能出色,无冷启动,价格实惠。
Qwen Image 3.0 Pro 文生图
Qwen Image 3.0 Pro 是一款专业级文生图模型,具备卓越画质和先进的提示词理解能力。最高支持 2k。提供开箱即用的 REST inference API,性能出色,无冷启动,价格实惠。
ai/prefect-pony-xl 动漫风格图片生成模型
Prefect Pony XL 可高质量生成动漫风格图片,适用于角色立绘和插画创作。提供开箱即用的 REST 推理 API,性能出色,无冷启动,价格实惠。
OpenAI GPT Image 2 文本生成图片
OpenAI 的 GPT Image 2 文本生成图片模型可根据自然语言提示词生成高质量图片。提供即用型 REST 推理 API,性能最佳,无冷启动,价格实惠。
OpenAI GPT Image 2 Edit 图像编辑
OpenAI 的 GPT Image 2 Edit 可通过自然语言指令结合一张或多张参考图片进行图像编辑。提供即用型 REST 推理 API,性能最佳,无冷启动,价格实惠。
OpenAI GPT Image 2.5 Sunburst 文本生成图片
面向复杂构图和高要求生产场景的高保真图片生成,最高支持 4K 输出。
OpenAI GPT Image 2.5 Flare 文本生成图片
根据自然语言提示词快速生成高质量图片,兼顾速度与效果,最高支持 4K 输出。