# ideogram（文生图）

**方法**: `POST`
**路径**: `/ideogram/generate`

Generates images synchronously based on a given prompt and optional parameters.
具体参数请看官方文档：<https://developer.ideogram.ai/api-reference/generate/post-generate-image>

根据给定的提示和可选参数同步生成图像。
返回的图像 URL 在 24 小时内有效，超过该时间将无法访问图像。
已反代图片

## 请求参数

### Header 参数

```text
accept
string
必需
示例:
application/json
content-type
string
必需
示例:
application/json
Authorization
string
可选
默认值:
Bearer {{YOUR_API_KEY}}
```

### Body 参数 application/json

```text
image_request
object
必需
aspect_ratio
string
必需
ASPECT_10_16、ASPECT_16_10、ASPECT_9_16、ASPECT_16_9、ASPECT_3_2、ASPECT_2_3、ASPECT_4_3、ASPECT_3_4、ASPECT_1_1、ASPECT_1_3、ASPECT_3_1
magic_prompt_option
string
必需
AUTO、ON、OFF
model
string
必需
V_1、V_1_TURBO、V_2、V_2_TURBO
prompt
string
必需
style_type
string
必需
negative_prompt
string
必需
resolution
string
必需
color_palette
string
必需
示例
{
"image_request"
:
{
"aspect_ratio"
:
"string"
,
"magic_prompt_option"
:
"string"
,
"model"
:
"string"
,
"prompt"
:
"string"
,
"style_type"
:
"string"
,
"negative_prompt"
:
"string"
,
"resolution"
:
"string"
,
"color_palette"
:
"string"
}
}
```

## 请求示例代码

### Shell

```bash
curl --location --request POST '/ideogram/generate' \
--header 'accept: application/json' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'content-type: application/json' \
--data-raw '{
    "image_request": {
        "aspect_ratio": "string",
        "magic_prompt_option": "string",
        "model": "string",
        "prompt": "string",
        "style_type": "string",
        "negative_prompt": "string",
        "resolution": "string",
        "color_palette": "string"
    }
}'
```

## 返回响应

### 🔴 500 成功

**内容类型**: `application/json`

#### 响应结构

```text
code
string
必需
message
string
必需
data
null
必需
```

#### 示例

```json
{
    "created": "2000-01-23T04:56:07Z",
    "data": [
        {
            "url": "https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g",
            "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.",
            "resolution": "1024x1024",
            "is_image_safe": true,
            "seed": 12345
        },
        {
            "url": "https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g",
            "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.",
            "resolution": "1024x1024",
            "is_image_safe": true,
            "seed": 12345
        }
    ]
}
```
