- (必读)网站使用教程
- (必读)前言
- 批量请求示例
- 常见问题及解决办法
- 聊天模型
- 音乐生成
- 绘画模型
- Midjourney
- Dalle和Gpt-image-1和Sora_image
- Flux
- Grok
- Stable-diffusion
- 即梦AI
- 可灵AI
- 音频模型
- 视频生成
- 查询令牌用量GET
- 查询令牌限额GET
(标准api调用)flux-kontext(文生图、图生图)
开发中
POST
https://api.apicore.ai/v1/images/generations
请求参数
Authorization
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token示例:
Authorization: Bearer ********************
Header 参数
Content-Type
string
可选
示例值:
application/json
Authorization
string
可选
示例值:
Bearer sk-xxxx
Body 参数application/json
model
string
模型名称
flux-kontext-pro
flux-kontext-max
prompt
string
文本提示,可包含图片URL
input_image
string
可选
默认值:
null
示例值:
"data:image/jpeg;base64,..."
seed
integer
随机种子,用于可重复生成
aspect_ratio
enum<string>
图像宽高比
枚举值:
21:916:94:31:13:49:169:21
默认值:
1:1
output_format
string
输出格式
默认值:
jpeg
示例值:
jpegpng
webhook_url
string
Webhook通知URL
默认值:
null
示例值:
"https://your-webhook.com"
webhook_secret
string
Webhook签名密钥
默认值:
null
示例值:
your-secret-key
prompt_upsampling
boolean
是否对提示进行上采样
默认值:
false
safety_tolerance
integer
安全容忍度级别(0-6)
默认值:
2
示例
{
"model": "flux-kontext-pro",
"prompt": "一只小猪",
"input_image": "null",
"seed": 0,
"aspect_ratio": "1:1",
"output_format": "jpeg",
"webhook_url": "null",
"webhook_secret": "null",
"prompt_upsampling": false,
"safety_tolerance": 2
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.apicore.ai/v1/images/generations' \
--header 'Authorization: Bearer sk-xxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "flux-kontext-pro",
"prompt": "一只小猪",
"input_image": "null",
"seed": 0,
"aspect_ratio": "1:1",
"output_format": "jpeg",
"webhook_url": "null",
"webhook_secret": "null",
"prompt_upsampling": false,
"safety_tolerance": 2
}'
返回响应
🟢200成功
application/json
Body
object {0}
示例
{
"data": [
{
"url": "https://fal.media/files/elephant/m9ss5JlP0jqhR_pwjspZ-_983106c5f64d4c938e82084430adcd9b.png"
}
],
"created": 1748929008
}