跳转到主要内容
POST
/
v1
/
images
/
generations
curl --request POST \
  --url https://api.foxapi.cc/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "grok-imagine-image",
  "prompt": "Abstract human silhouette, golden particles ready to burst outward representing joy",
  "num_outputs": 1,
  "aspect_ratio": "1:1",
  "output_format": "jpg"
}
'
{
  "created": 1757165031,
  "id": "task-unified-1757165031-uyujaw3d",
  "model": "<string>",
  "object": "image.generation.task",
  "progress": 0,
  "status": "pending",
  "task_info": {
    "can_cancel": true,
    "estimated_time": 45
  },
  "type": "image"
}

Documentation Index

Fetch the complete documentation index at: https://docs.foxapi.cc/llms.txt

Use this file to discover all available pages before exploring further.

授权

Authorization
string
header
必填

所有接口均需要使用Bearer Token进行认证

使用时在请求头中添加:

Authorization: Bearer YOUR_API_KEY

请求体

application/json
model
string
默认值:grok-imagine-image
必填

grok-imagine-image:支持文生图和图像编辑

示例:

"grok-imagine-image"

prompt
string
必填

图像生成提示词

说明:

  • 文生图模式:描述想要生成的图像内容
  • 图像编辑模式:描述对输入图像的编辑要求
示例:

"Abstract human silhouette, golden particles ready to burst outward representing joy"

num_outputs
integer
默认值:1

输出图片数量

说明:

  • 范围:1 - 4
  • 每张图片独立计费
示例:

1

aspect_ratio
string | null

输出图像宽高比

可选值:

  • 2:120:919.5:916:94:33:21:1
  • 2:33:49:169:19.59:201:2

说明:

  • 仅文生图模式支持
  • 未传时默认 1:1
示例:

"1:1"

output_format
string | null

输出图片格式

可选值:

  • jpg / jpeg
  • png
  • webp

说明:

  • 未传时默认 jpeg

非必须不要传这个参数。

示例:

"jpg"

image_urls
string[] | null

输入图片 URL 列表

说明:

  • 传入后自动切换到图像编辑模式
  • 最多支持 3 张输入图片
  • 推荐使用公开可访问的图片 URL
示例:
["https://example.com/input-image.png"]

响应

任务创建成功

created
integer

任务创建时间戳

示例:

1757165031

id
string

任务ID

示例:

"task-unified-1757165031-uyujaw3d"

model
string

实际使用的模型名称

object
enum<string>

任务的具体类型

可用选项:
image.generation.task
progress
integer

任务进度百分比 (0-100)

必填范围: 0 <= x <= 100
示例:

0

status
enum<string>

任务状态

可用选项:
pending,
processing,
completed,
failed
示例:

"pending"

task_info
object

异步任务信息

type
enum<string>

任务的输出类型

可用选项:
image
示例:

"image"