curl --request POST \
--url https://api.tikway.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "microsoft/mai-image-2.5-pro",
"prompt": "雨夜的未来城市,写实摄影",
"size": "1024x1024",
"response_format": "url"
}
'
{
"created": 1788923928,
"data": [
{
"index": 0,
"b64_json": "iVBORw0KGgoAAAANSUhEUgAA..."
}
],
"model": "microsoft/mai-image-2.5-pro",
"output_format": "png",
"size": "1024x1024",
"usage": {
"input_tokens": 36,
"input_tokens_details": {
"text_tokens": 36
},
"output_tokens": 1024,
"output_tokens_details": {
"image_tokens": 1024
},
"total_tokens": 1060
}
}MAI Image
生成图片
microsoft/mai-image-2.5-pro 通过生成接口支持文生图和图生图。参考图使用可选 images,最多 1 张;每次生成一张 PNG。size 的宽、高均至少 768,总像素不超过 1,048,576。
POST
https://api.tikway.ai
/
v1
/
images
/
generations
curl --request POST \
--url https://api.tikway.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "microsoft/mai-image-2.5-pro",
"prompt": "雨夜的未来城市,写实摄影",
"size": "1024x1024",
"response_format": "url"
}
'
{
"created": 1788923928,
"data": [
{
"index": 0,
"b64_json": "iVBORw0KGgoAAAANSUhEUgAA..."
}
],
"model": "microsoft/mai-image-2.5-pro",
"output_format": "png",
"size": "1024x1024",
"usage": {
"input_tokens": 36,
"input_tokens_details": {
"text_tokens": 36
},
"output_tokens": 1024,
"output_tokens_details": {
"image_tokens": 1024
},
"total_tokens": 1060
}
}授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
application/json
MAI Image 文生图与图生图的标准请求。
必填。使用 Get Models 返回的模型 ID 或可用别名。
Minimum string length:
1示例:
"microsoft/mai-image-2.5-pro"
必填。图片提示词,原生模型上下文上限 32,000 tokens。
Minimum string length:
1示例:
"一座漂浮在云海上的未来城市,日出时分,电影级光影,建筑细节丰富"
兼容尺寸 WIDTHxHEIGHT。MAI Image 2.5 Pro 的宽、高均至少 768,且总像素不超过 1,048,576。
Pattern:
^[1-9][0-9]*x[1-9][0-9]*$返回形式:url 返回图片地址,b64_json 返回图片 Base64。
可用选项:
b64_json, url 可选。单张图生图参考图,支持 JPEG 或 PNG;省略时为文生图。
Required array length:
1 elementMinimum string length:
1响应
200 - application/json
统一转换后的 OpenAI Images 响应。
图片创建时间的 Unix 时间戳,单位为秒。
示例:
1788480000
实际执行请求的模型标识。
实际输出格式。
实际生成尺寸。
本次生成的用量信息。
Hide child attributes
Hide child attributes
输入 token 数。
输出 token 数。
总 token 数。

