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

# Seedream 5.0 Pro · 文生图

> Seedream 5.0 Pro 文生图参数、限制与可直接复制的调用示例

## 简介

使用文本提示词生成 1 张图片，不传 `image`。不支持文生透明图。需要参考图编辑、多图融合或图层拆分时，请查看 [图生图](https://docs.gravitex.ai/cn/api-reference/endpoint/seedream-5.0/edits.md)。

## 接口与认证

```http theme={null}
POST https://api.gravitex.ai/v1/images/generations
```

使用 `Authorization: Bearer sk-xxxxxxxxxx` 和 `Content-Type: application/json`。认证和接口规则见 [参数与计费](https://docs.gravitex.ai/cn/api-reference/endpoint/seedream-5.0.md#认证)。

## 请求参数

| 参数 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `model` | string | 是 | `dola-seedream-5-0-pro-260628` |
| `prompt` | string | 是 | 描述希望生成的图片；中文建议不超过 300 字，英文不超过 600 词 |
| `size` | string | 否 | 生成默认 `2K`，支持 `1K`、`1.5K`、`2K` 或自定义 `宽x高` |
| `output_format` | string | 否 | `jpeg` / `png`，默认 `jpeg`；透明图使用 `png` |
| `response_format` | string | 否 | `url` / `b64_json`，默认 `url` |
| `watermark` | boolean | 否 | 默认 `true`；不添加水印时传 `false` |
| `optimize_prompt_options` | object | 否 | `mode` 支持 `standard`（默认）/ `fast` |

`n` 传 `1` 或不传；需要多张普通生成结果时请分别请求。`safety_identifier`、完整默认值和参数解释见 [通用参数](https://docs.gravitex.ai/cn/api-reference/endpoint/seedream-5.0.md#请求参数)。两版均不支持 `quality`、组图、流式输出与联网搜索。

### size

支持档位 `1K`、`1.5K`、`2K`，默认 `2K`；可在提示词中描述宽高比。自定义 `宽x高` 使用小写 `x`，总像素必须在 `[921600, 4624220]` 内，宽高比在 `[1/16, 16]` 内。例如 `1024x1024` 有效，`512x512` 无效。完整尺寸表见 [尺寸说明](https://docs.gravitex.ai/cn/api-reference/endpoint/seedream-5.0.md#size)。

> [!NOTE]
>
> Seedream 5.0 Pro 不支持文生透明图；需要输入带透明通道的参考图时，请查看 [图生图透明通道说明](https://docs.gravitex.ai/cn/api-reference/endpoint/seedream-5.0/edits.md#background)。

## 调用示例

每个示例提供可直接复制的完整 JSON 请求 body 和对应 cURL。使用 cURL 时，请将 `sk-xxxxxxxxxx` 替换为自己的 API Key。

### 文生图

```json 请求 body theme={null}
{
  "model": "dola-seedream-5-0-pro-260628",
  "prompt": "未来城市夜景，电影海报风格，16:9 横版",
  "size": "2K",
  "watermark": false
}
```

```bash cURL theme={null}
curl --location 'https://api.gravitex.ai/v1/images/generations' \
  --header 'Authorization: Bearer sk-xxxxxxxxxx' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "dola-seedream-5-0-pro-260628",
    "prompt": "未来城市夜景，电影海报风格，16:9 横版",
    "size": "2K",
    "watermark": false
  }'
```

### 提示词优化

```json 请求 body theme={null}
{
  "model": "dola-seedream-5-0-pro-260628",
  "prompt": "未来城市夜景，电影海报风格",
  "optimize_prompt_options": {
    "mode": "fast"
  },
  "safety_identifier": "5f4dcc3b5aa765d61d8327deb882cf99"
}
```

```bash cURL theme={null}
curl --location 'https://api.gravitex.ai/v1/images/generations' \
  --header 'Authorization: Bearer sk-xxxxxxxxxx' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "dola-seedream-5-0-pro-260628",
    "prompt": "未来城市夜景，电影海报风格",
    "optimize_prompt_options": {
      "mode": "fast"
    },
    "safety_identifier": "5f4dcc3b5aa765d61d8327deb882cf99"
  }'
```

## 成功返回

普通生成返回 1 张图片。`response_format: "url"` 时读取 `data[].url`，24 小时内下载保存；使用 `b64_json` 时读取 `data[].b64_json` 并解码。响应示例、完整字段和用量解释见 [基础响应](https://docs.gravitex.ai/cn/api-reference/endpoint/seedream-5.0.md#成功返回)。

## 计费与错误处理

文生图无需参考图费用，输出图按实际像素定档。详细价格和示例见 [计费说明](https://docs.gravitex.ai/cn/api-reference/endpoint/seedream-5.0.md#计费说明)；排查参数、图片读取等问题见 [错误处理](https://docs.gravitex.ai/cn/api-reference/endpoint/seedream-5.0.md#错误处理)。


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