Appearance
flux 绘图模型
其他语言 可通过 curl 实例 用 类似 dall-e-3 的 api 接口
curl 实例
shell
curl https://api.openai-hk.com/v1/images/generations \
-H 'Authorization: Bearer hk-替换为你的key' \
-H "Content-Type: application/json" \
-d '{
"model": "flux",
"prompt": "a white siamese cat",
"n": 1,
"size": "1024x1024"
}'
curl https://api.openai-hk.com/v1/images/generations \
-H 'Authorization: Bearer hk-替换为你的key' \
-H "Content-Type: application/json" \
-d '{
"model": "flux",
"prompt": "a white siamese cat",
"n": 1,
"size": "1024x1024"
}'
在线测试
注意 1.访问 https://flux.ddaiai.com (如果被墙了,换下二级域名前缀 suibian
)
2.如果发现被墙了 可以自己换地址 https://suibian.ddaiai.com
把 suibian
换其他的 如 https://2024.ddaiai.com
都能访问
设置
然后在下图相应的地方设置
OpenAi接口地址:https://api.openai-hk.com
OpenAi API KEY: hk-你的apiKey
然后在下图相应的地方设置
OpenAi接口地址:https://api.openai-hk.com
OpenAi API KEY: hk-你的apiKey
效果
输入框 提问对话
Flux Api
- 1.生成任务
- 2.查询任务状态
生成任务
shell
curl --request POST \
--url https://api.openai-hk.com/vmodel/generate \
--header 'Authorization: Bearer hk-your-key' \
--header 'Content-Type: application/json' \
--data '{
"model":"flux-schnell",
"input": {
"prompt": "空气",
"num_outputs": 1,
"aspect_ratio": "1:1",
"output_format": "jpg",
"output_quality": 80,
"seed": 1900004
}
}'
curl --request POST \
--url https://api.openai-hk.com/vmodel/generate \
--header 'Authorization: Bearer hk-your-key' \
--header 'Content-Type: application/json' \
--data '{
"model":"flux-schnell",
"input": {
"prompt": "空气",
"num_outputs": 1,
"aspect_ratio": "1:1",
"output_format": "jpg",
"output_quality": 80,
"seed": 1900004
}
}'
请求体关键字说明
字段 | 类型 | 说明 |
---|---|---|
model | string | 可选 flux flux-schnell flux-dev flux-pro |
input | object | 该模型下的参数 |
input.prompt | string | 提示语 |
input.num_outputs | number | 输出的张数 1-4 |
input.output_quality | number | 输出的质量 1-100 |
input.seed | number | 种子随机数 |
input.aspect_ratio | string | 比例 1:1 3:4 4:3 16:9 9:16 2:3 3:2 |
返回体 得到 id
json
{
"id": "j3thn0r501rme0cm9xq9sy6xkc"
}
{
"id": "j3thn0r501rme0cm9xq9sy6xkc"
}
查询任务状态
json
{
"id": "j3thn0r501rme0cm9xq9sy6xkc",
"model": "flux-schnell",
"input": {
"aspect_ratio": "1:1",
"num_outputs": 1,
"output_format": "jpg",
"output_quality": 80,
"prompt": "空气",
"seed": 1900004
},
"output": [
"https://file.aigpai.com/xezq/g44ll27rzLKfdSUDv0UKeYcKYkbhNeUC6USpE3uRW0VMWSHoA/out-0.jpg"
],
"status": "succeeded",
"error": null
}
{
"id": "j3thn0r501rme0cm9xq9sy6xkc",
"model": "flux-schnell",
"input": {
"aspect_ratio": "1:1",
"num_outputs": 1,
"output_format": "jpg",
"output_quality": 80,
"prompt": "空气",
"seed": 1900004
},
"output": [
"https://file.aigpai.com/xezq/g44ll27rzLKfdSUDv0UKeYcKYkbhNeUC6USpE3uRW0VMWSHoA/out-0.jpg"
],
"status": "succeeded",
"error": null
}
关键字说明
字段 | 类型 | 说明 |
---|---|---|
id | string | |
model | string | 可选 flux flux-schnell flux-dev flux-pro |
input | object | 该模型下的参数 |
output | []string | 结果 url 地址 |
status | string | 状态 starting processing succeeded failed |
error | string | 错误信息 |