> ## Documentation Index
> Fetch the complete documentation index at: https://apixo.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 生成 API 参数：请求结构与模型输入

> 构建生成请求，选择轮询或回调，并检查特定于模型的模式、参考输入和限制。

生成请求分为两部分。顶层字段指定如何获取结果，`input` 对象指定路径中的模型要执行什么任务。切换模型时，请先核对新模型的输入参数表，再决定能否沿用原请求体。

## 请求结构

下面的示例向 `POST /api/v1/generateTask/nano-banana` 提交一个只使用提示词的任务：

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "text-to-image",
    "prompt": "A green ceramic teapot on a white shelf",
    "aspect_ratio": "1:1"
  }
}
```

### 顶级参数

| 字段 | 使用 |
| - | - |
| `input` | 包含所选模型和模式字段的必需对象。 |
| `request_type` | 省略时默认为 `async`。轮询返回的任务 ID，或将此字段设置为 `callback` 以进行 Webhook 传递。检查模型参考以了解其他支持的选项。 |
| `callback_url` | 当`request_type`为`callback`时需要。提供可公开访问的 HTTPS 端点。在 `async` 模式下轮询时可以省略此字段。请参阅 [Webhooks](https://apixo.ai/docs/zh/api-reference/webhooks.md)。 |

## 图像生成参数

对于 [Nano Banana](https://apixo.ai/docs/zh/models/image/nano-banana.md)，仅使用 `text-to-image` 进行提示，或使用 `image-to-image` 和一到五个参考图像进行编辑。[GPT Image 1](https://apixo.ai/docs/zh/models/image/gpt-image-1.md) 使用 `gpt-image-1` 作为这两个任务的模式。仅更改端点中的模型 ID 会在主体中保留旧模式。

## 视频生成参数

检查每个媒体插槽的含义。对于 [Kling 2.5 Turbo Pro](https://apixo.ai/docs/zh/models/video/kling-2-5-turbo-pro.md)，两个图像 URL 指定开帧和闭帧。对于 [Wan 2.2 Animate](https://apixo.ai/docs/zh/models/video/wan-2-2-animate.md)，角色进入 `image_urls`，运动剪辑进入 `video_urls`。检查所选模型参考中的持续时间、分辨率和必填字段。

## 音频生成参数

[MiniMax Speech 2.8](https://apixo.ai/docs/zh/models/audio/minimax-speech-2-8.md) 使用语音 ID 进行语音合成。[Suno](https://apixo.ai/docs/zh/models/audio/suno.md) 提供音乐控件，例如 `instrumental`。使用您实际想要运行的音频任务的请求示例。

## 长宽比参考

`1:1`（方形）、`16:9`（横向）和 `9:16`（纵向）等值描述了输出形状。支持的比率和默认值取决于模型和模式。在转发用户的选择之前检查这些值。

## 快速参考

1. 从 [模型目录](https://apixo.ai/docs/zh/models.md) 中选择公共模型 ID。
2. 复制该模型在目标模式下的示例，并替换其提示和媒体 URL。
3. [提交任务](https://apixo.ai/docs/zh/api-reference/generate-task.md)。对于轮询，保存模型和返回的任务 ID 并使用 [查询任务状态](https://apixo.ai/docs/zh/api-reference/status-task.md) 检索结果。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.