输出分辨率
根据已发布的 endpoint 规格,支持 1k。
curl -X POST https://runapi.ai/api/v1/flux_2/text_to_image \
-H "Authorization: Bearer $RUNAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-2-max-text-to-image",
"prompt": "生成一张写实风格的宇航员抱着猫的摄影棚人像,戏剧性轮廓光,精细细节。"
}'
import { Flux2Client } from "@runapi.ai/flux-2";
const client = new Flux2Client();
const result = await client.textToImage.run({
model: "flux-2-max-text-to-image",
prompt: "生成一张写实风格的宇航员抱着猫的摄影棚人像,戏剧性轮廓光,精细细节。",
});
import os
import requests
response = requests.post(
"https://runapi.ai/api/v1/flux_2/text_to_image",
headers={"Authorization": f"Bearer {os.environ['RUNAPI_API_KEY']}"},
json={"model":"flux-2-max-text-to-image","prompt":"生成一张写实风格的宇航员抱着猫的摄影棚人像,戏剧性轮廓光,精细细节。"}
)
response.raise_for_status()
<?php
$client = curl_init("https://runapi.ai/api/v1/flux_2/text_to_image");
curl_setopt_array($client, [
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("RUNAPI_API_KEY"), "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
'model' => 'flux-2-max-text-to-image',
'prompt' => '生成一张写实风格的宇航员抱着猫的摄影棚人像,戏剧性轮廓光,精细细节。',
])
]);
$response = curl_exec($client);
RunApi client = new RunApi(System.getenv("RUNAPI_API_KEY"));
Task task = client.textToImage().run({"model":"flux-2-max-text-to-image","prompt":"生成一张写实风格的宇航员抱着猫的摄影棚人像,戏剧性轮廓光,精细细节。"});
task.waitForResult();
require "runapi/flux_2"
client = RunApi::Flux2::Client.new
result = client.text_to_image.run(
model: "flux-2-max-text-to-image",
prompt: "生成一张写实风格的宇航员抱着猫的摄影棚人像,戏剧性轮廓光,精细细节。"
)
client := runapi.NewClient(os.Getenv("RUNAPI_API_KEY"))
task, err := client.textToImage.Run({"model":"flux-2-max-text-to-image","prompt":"生成一张写实风格的宇航员抱着猫的摄影棚人像,戏剧性轮廓光,精细细节。"})
if err != nil { log.Fatal(err) }
task.Wait()
$ runapi generate \
--model flux-2-max-text-to-image \
--endpoint text_to_image \
--wait
6 个版本可用
选择任意模型,几秒内开始生成。
选择任意模型,几秒内开始生成。
| 提供商 | Black Forest Labs |
| 模型 ID | flux-2-max-text-to-image |
| 模态 | Image |
| 任务类型 | Asynchronous |
| API 端点 | /api/v1/flux_2/text_to_image |
| 计费单位 | call |
| 输入参数 | aspect_ratio, callback_url, model, output_count, output_resolution, prompt |
| 最大分辨率 | 1k |
| 宽高比 | 1:1, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3 |
| 目录状态 | 运行中 |
免费注册后,在控制台创建用于 flux-2-max-text-to-image 的 API 密钥。
向 /api/v1/flux_2/text_to_image 发送 POST 请求,并传入 flux-2-max-text-to-image 模型 ID 和参数。
轮询任务或按照回调获取已完成的 flux-2-max-text-to-image 结果。
根据已发布的 endpoint 规格,支持 1k。
可配置文档中列出的 4 个参数,包括 aspect_ratio, output_count, output_resolution, prompt。
提供 1 个公开 endpoint:text_to_image。
异步任务支持回调 URL,任务完成时发送通知。
promptImage description.
aspect_ratioOutput aspect ratio. (1:1, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3)
callback_urlWebhook URL for async notifications.
output_countNumber of images to generate. (1)
output_resolutionOutput resolution. (1k)
为缺少棚拍照片的电商商品自动生成场景化产品图。
快速概念化环境和角色,再进入最终美术制作。
为博客文章和专栏批量生成独特封面图和插图。
传入 quickstart 中显示的模型 ID。
Key 级限流随使用层级伸缩。当前限制见定价页。
可以——变体只是参数,改 model 字段即可。
模型支持流式时,RunAPI 端到端流式。
在公共 GitHub 仓库提 issue 或邮件联系 support。