> ## 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.5 Pro · 文生图

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

## 简介

使用文本提示词生成 1 张图片，不传 `image`。支持直接生成透明背景图片。需要参考图编辑、多图融合或图层拆分时，请查看 [图生图](https://docs.gravitex.ai/cn/api-reference/endpoint/seedream-5.5/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.5.md#认证)。

## 请求参数

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

`n` 传 `1` 或不传；需要多张普通生成结果时请分别请求。`safety_identifier`、完整默认值和参数解释见 [通用参数](https://docs.gravitex.ai/cn/api-reference/endpoint/seedream-5.5.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.5.md#size)。

### background

控制输出图片是否带透明通道。

| 取值 | 说明 |
| - | - |
| `auto` | 模型根据提示词和 `output_format` 自动判断，默认值；`output_format` 为 `jpeg` 时不带透明通道 |
| `transparent` | 输出带透明通道的 RGBA 图 |
| `opaque` | 输出不带透明通道的 RGB 图 |

> [!NOTE]
>
> * 文生图支持 `transparent`，无需参考图片。
> * 实际是否透明以响应里的 `data[].background` 为准，可能和请求值不同。

> [!WARNING]
>
> `transparent` 不能和 `output_format: "jpeg"` 同时用，否则报错。

## 调用示例

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

### 文生图

```json 请求 body theme={null}
{
  "model": "dola-seedream-5-5-261028",
  "prompt": "未来城市夜景，电影海报风格，16:9 横版",
  "size": "2K",
  "output_format": "jpeg",
  "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-5-261028",
    "prompt": "未来城市夜景，电影海报风格，16:9 横版",
    "size": "2K",
    "output_format": "jpeg",
    "watermark": false
  }'
```

### 文生透明图

```json 请求 body theme={null}
{
  "model": "dola-seedream-5-5-261028",
  "prompt": "一个卡通风格的火箭贴纸，透明背景",
  "background": "transparent",
  "output_format": "png",
  "size": "1K"
}
```

```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-5-261028",
    "prompt": "一个卡通风格的火箭贴纸，透明背景",
    "background": "transparent",
    "output_format": "png",
    "size": "1K"
  }'
```

## 成功返回

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

## 计费与错误处理

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


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