# OpenAI Image Models

{% hint style="danger" %}
此文档已停止维护，最新文档地址：<https://docs.ttapi.io>
{% endhint %}

## OpenAI Create image

{% hint style="info" %}
gpt-image-1 模型官方耗时比较长，建议使用我们的 <https://api.ttapi.org> 网关，避免请求超时
{% endhint %}

<mark style="color:green;">`POST`</mark> `https://api.ttapi.io/v1/images/generations`

根据文本以及图片提示创建图像，转自openai官方接口，支持模型 `gpt-image-1`, `dall-e-2`, `dall-e-3`

文档翻译自[官方文档](https://platform.openai.com/docs/api-reference/images/create)，如已对接官方文档可直接对接使用，所有入参出参结构与支持均一致，[定价详见](https://docs-zh.mjapiapp.com/ttapi-zhong-wen-wen-dang#openai-create-image-ding-jia)

**Headers**

| Name         | Value                  |
| ------------ | ---------------------- |
| Content-Type | `application/json`     |
| TT-API-KEY   | `用于请求授权 TT-API 的API密钥` |

**Body**

<table><thead><tr><th width="196">参数</th><th width="107">类型</th><th width="169">是否必须</th><th>描述</th></tr></thead><tbody><tr><td><code>prompt</code></td><td>string</td><td>是</td><td>图像的<strong>文本描述</strong>。<code>gpt-image-1</code> 的最大长度为 32000 个字符，<code>dall-e-2</code> 的最大长度为 1000 个字符，<code>dall-e-3</code> 的最大长度为 4000 个字符。</td></tr><tr><td><code>background</code></td><td>string</td><td>否</td><td><p>允许<strong>设置生成图像背景的透明度</strong>。<br>此参数仅适用于 <code>gpt-image-1</code>。可选值 <code>transparent</code>、<code>opaque</code> 或 <code>auto</code>（默认）之一。使用 <code>auto</code> 时，模型将自动确定图像的最佳背景。</p><p>如果设置为透明，则输出格式需要支持透明度，因此应设置为 png 或 webp。</p></td></tr><tr><td><code>model</code></td><td>string</td><td>否</td><td><p><strong>支持模型</strong></p><p><code>gpt-image-1</code></p><p><code>dall-e-2</code>（默认）</p><p><code>dall-e-3</code></p></td></tr><tr><td><code>moderation</code></td><td>string</td><td>否</td><td>控制 gpt-image-1 生成的图片的<strong>内容审核级别</strong>。<code>low</code>（用于限制较少的过滤）或 <code>auto</code>（默认值）。</td></tr><tr><td><code>n</code></td><td>integer</td><td>否</td><td><strong>生成图像数量</strong>，默认值为1<br>可选范围<code>1-10</code>，<code>dall-e-3</code>为固定值<code>1</code></td></tr><tr><td><code>output_compression</code></td><td>integer</td><td>否</td><td><strong>生成图像的压缩级别</strong> (0-100%)。此参数仅支持输出格式为 webp 或 jpeg 的 <code>gpt-image-1</code>，默认为 <code>100</code>。</td></tr><tr><td><code>output_format</code></td><td>string</td><td>否</td><td><strong>返回图像格式</strong>。此参数仅适用于 <code>gpt-image-1</code>。可选值 <code>png</code>（默认）、<code>jpeg</code> 、 <code>webp</code> 。</td></tr><tr><td><code>quality</code></td><td>string</td><td>否</td><td><strong>图片质量</strong>，可选范围：<br><code>auto</code>（默认值）将自动为给定模型选择最佳质量。<br>gpt-image-1 支持<code>high</code>、<code>medium</code>、<code>low</code>三种质量。<br>dall-e-3 支持 <code>hd</code> 和 <code>standard</code>。<br>dall-e-2 仅支持 <code>standard</code>。</td></tr><tr><td><code>response_format</code></td><td>string</td><td>否</td><td><strong>返回数据格式</strong><br>dall-e-3, dall-e-2 支持 <code>url</code>或 <code>b64_json</code>，url有效期为60分钟，请获取到数据后第一时间缓存。<br>gpt-image-1 仅支持 <code>b64_json</code></td></tr><tr><td><code>size</code></td><td>string</td><td>否</td><td><p><strong>图像尺寸</strong></p><p>gpt-image-1 可选范围：<br>1024x1024<br>1536x1024<br>1024x1536<br>auto（默认）</p><p>dall-e-2 可选范围：<br>256x256<br>512x512<br>1024x1024<br>dall-e-3 可选范围：<br>1024x1024<br>1792x1024<br>1024x1792<br><strong>注意：不同尺寸消耗ttapi quota不同</strong></p></td></tr><tr><td><code>style</code></td><td>string</td><td>否</td><td><p><strong>生成图像的风格</strong>。此参数仅支持 dall-e-3。<br>可选值：</p><p><code>vivid</code>（生动）</p><p><code>natural</code>（自然）</p></td></tr></tbody></table>

#### 请求示例

{% tabs %}
{% tab title="Python" %}

```
import requests

endpoint = "https://api.ttapi.io/v1/images/generations"

headers = {
    "TT-API-KEY": your_key
}

data = {
    "prompt": "a cute cat",
    "model":"gpt-image-1",
    "size": "1024x1024",
}

response = requests.post(endpoint, headers=headers, json=data)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node" %}

```
const axios = require('axios');

let config = {
  method: 'post',
  url: 'https://api.ttapi.io/openai/v1/images/generations',
  headers: { 
    'TT-API-KEY': 'your_key'
  },
  data : {
    "prompt": "a cute cat",
    "model": "gpt-image-1",
    "size": "1024x1024 "
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.status));
})
.catch(function (error) {
  console.log(error);
});
```

{% endtab %}
{% endtabs %}

#### 返回示例

{% tabs %}
{% tab title="200（url）" %}

```json
{
    "data": [
        {
            "url": "https://filesystem.site/cdn/20250428/5LsFMT0Def02RVVUkwJ4v7IslleMzo.webp",
            "revised_prompt": "A cute fluffy cat with big, bright eyes, soft fur, and a playful expression. It has a light gray coat with hints of white on its paws and tail. The cat is sitting in a cozy setting, surrounded by soft cushions, with its tail wrapped around its paws. Its ears are perked up, and it's looking directly at the viewer, exuding a sense of curiosity and warmth."
        }
    ],
    "created": 1745818538
}
```

{% endtab %}

{% tab title="200（base64）" %}

```
{
    "created": 1745818890,
    "data": [
        {
            "b64_json": "iVBORw0KGgoAAAANSUhE..."
        }
    ],
    "usage": {
        "input_tokens": 9,
        "input_tokens_details": {
            "image_tokens": 0,
            "text_tokens": 9
        },
        "output_tokens": 4160,
        "total_tokens": 4169
    }
}
```

{% endtab %}
{% endtabs %}

## OpenAI Create image edit

<mark style="color:green;">`POST`</mark> `https://api.ttapi.io/v1/images/edits`

根据给定的一个或多个源图像和提示，编辑或扩展图像。支持模型 `gpt-image-1`, `dall-e-2`

文档翻译自[官方文档](https://platform.openai.com/docs/api-reference/images/createEdit)，如已对接官方文档可直接对接使用，所有入参出参结构与支持均一致，[定价详见](https://docs-zh.mjapiapp.com/ttapi-zhong-wen-wen-dang#openai-create-image-ding-jia)

**Headers**

| Name         | Value                  |
| ------------ | ---------------------- |
| Content-Type | `application/json`     |
| TT-API-KEY   | `用于请求授权 TT-API 的API密钥` |

**Body**

<table><thead><tr><th width="196">参数</th><th width="107">类型</th><th width="169">是否必须</th><th>描述</th></tr></thead><tbody><tr><td>image</td><td>array[file]</td><td>是</td><td><strong>要编辑的图片</strong>。必须是受支持的图片文件或图片数组。<br><code>gpt-image-1</code>，每张图片应为小于 25MB 的 png、webp 或 jpg 文件。<br><code>dall-e-2</code>，您只能提供一张图片，并且该图片应为小于 4MB 的方形 png 文件。</td></tr><tr><td><code>prompt</code></td><td>string</td><td>是</td><td>图像的<strong>文本描述</strong>。<code>gpt-image-1</code> 的最大长度为 32000 个字符，<code>dall-e-2</code> 的最大长度为 1000 个字符</td></tr><tr><td><code>mask</code></td><td>file</td><td>否</td><td><strong>一张附加图片，其完全透明区域（例如，Alpha 值为零）指示应编辑图片的位置</strong>。如果提供了多张图片，则蒙版将应用于第一张图片。必须是有效的 PNG 文件，大小小于 4MB，且尺寸与图片相同。</td></tr><tr><td><code>model</code></td><td>string</td><td>否</td><td><p><strong>支持模型</strong></p><p><code>gpt-image-1</code></p><p><code>dall-e-2</code>（默认）</p></td></tr><tr><td><code>n</code></td><td>integer</td><td>否</td><td><strong>生成图像数量</strong>，默认值为1<br>可选范围<code>1-10</code></td></tr><tr><td><code>output_compression</code></td><td>integer</td><td>否</td><td><strong>生成图像的压缩级别</strong> (0-100%)。此参数仅支持输出格式为 webp 或 jpeg 的 <code>gpt-image-1</code>，默认为 <code>100</code>。</td></tr><tr><td><code>quality</code></td><td>string</td><td>否</td><td><strong>图片质量</strong>，可选范围：<br><code>auto</code>（默认值）将自动为给定模型选择最佳质量。<br>gpt-image-1 支持<code>high</code>、<code>medium</code>、<code>low</code>三种质量。<br>dall-e-2 仅支持 <code>standard</code>。</td></tr><tr><td><code>response_format</code></td><td>string</td><td>否</td><td><strong>返回数据格式</strong><br>dall-e-2 支持 <code>url</code>或 <code>b64_json</code>，url有效期为60分钟，请获取到数据后第一时间缓存。<br>gpt-image-1 仅支持 <code>b64_json</code></td></tr><tr><td><code>size</code></td><td>string</td><td>否</td><td><p><strong>图像尺寸</strong></p><p>gpt-image-1 可选范围：<br>1024x1024<br>1536x1024<br>1024x1536<br>auto（默认）</p><p></p><p>dall-e-2 可选范围：<br>256x256<br>512x512<br>1024x1024<br><br><strong>注意：不同尺寸消耗ttapi quota不同</strong></p></td></tr></tbody></table>

#### 请求示例

{% tabs %}
{% tab title="Python" %}

```
import base64
from openai import OpenAI

client = OpenAI(
    base_url="https://api.ttapi.io/v1",
    api_key="your api key",
)

prompt = """
Generate a photorealistic image of a gift basket on a white background 
labeled 'Relax & Unwind' with a ribbon and handwriting-like font, 
containing all the items in the reference pictures.
"""

result = client.images.edit(
    model="gpt-image-1",
    image=[
        open("body-lotion.png", "rb"),
        open("bath-bomb.png", "rb"),
        open("incense-kit.png", "rb"),
        open("soap.png", "rb"),
    ],
    prompt=prompt
)

image_base64 = result.data[0].b64_json
image_bytes = base64.b64decode(image_base64)

# Save the image to a file
with open("gift-basket.png", "wb") as f:
    f.write(image_bytes)
```

{% endtab %}

{% tab title="Node" %}

```
import fs from "fs";
import OpenAI, { toFile } from "openai";


const client = new OpenAI({
  apiKey: "your api key", 
  baseURL: "https://api.ttapi.io/v1"
});

const imageFiles = [
    "bath-bomb.png",
    "body-lotion.png",
    "incense-kit.png",
    "soap.png",
];

const images = await Promise.all(
    imageFiles.map(async (file) =>
        await toFile(fs.createReadStream(file), null, {
            type: "image/png",
        })
    ),
);

const rsp = await client.images.edit({
    model: "gpt-image-1",
    image: images,
    prompt: "Create a lovely gift basket with these four items in it",
});

// Save the image to a file
const image_base64 = rsp.data[0].b64_json;
const image_bytes = Buffer.from(image_base64, "base64");
fs.writeFileSync("basket.png", image_bytes);

```

{% endtab %}
{% endtabs %}

#### 返回示例

{% tabs %}
{% tab title="200" %}

```json
{
  "created": 1713833628,
  "data": [
    {
      "b64_json": "..."
    }
  ],
  "usage": {
    "total_tokens": 100,
    "input_tokens": 50,
    "output_tokens": 50,
    "input_tokens_details": {
      "text_tokens": 10,
      "image_tokens": 40
    }
  }
}

```

{% endtab %}
{% endtabs %}

## Dalle3 生成图像

<mark style="color:green;">`POST`</mark> `https://api.ttapi.io/openai/v1/images/generations`

根据文本提示使用DALL·E 3模型创建图像。DALL·E 3模型相对于市场上的其他模型而言对文字理解能力最强，你可以使用任何语言作为你的描述文案，[价格详见](https://docs-zh.mjapiapp.com/ttapi-zhong-wen-wen-dang#dalle3-ding-jia)，**此接口已不推荐使用**

**Headers**

| Name         | Value                  |
| ------------ | ---------------------- |
| Content-Type | `application/json`     |
| TT-API-KEY   | `用于请求授权 TT-API 的API密钥` |

**Body**

<table><thead><tr><th width="166">参数</th><th width="107">类型</th><th width="169">是否必须</th><th>描述</th></tr></thead><tbody><tr><td><code>prompt</code></td><td>string</td><td>是</td><td>dall-e-3模型，描述词长度不能超过4000个字符</td></tr><tr><td><code>size</code></td><td>string</td><td>是</td><td><p>图像尺寸，可选范围：</p><p>1024x1024 </p><p>1024x1792</p><p> 1792x1024<br>注意：不同尺寸消耗ttapi quota不同</p></td></tr><tr><td><code>model</code></td><td>string</td><td>否</td><td>固定值：dall-e-3</td></tr><tr><td><code>n</code></td><td>integer</td><td>否</td><td>生成图像数量，固定值：1</td></tr><tr><td><code>quality</code></td><td>string</td><td>否</td><td>图片质量，可选范围：<br>standard - 标准<br>hd - 增强细节</td></tr></tbody></table>

{% hint style="info" %}
注意：dalle3接口的任务结果是同步返回的并不需要异步回调或者再次去查询该任务结果，接口响应时间一般在3-15s中间，时效同步根据OpenAI官方。
{% endhint %}

#### 请求示例

{% tabs %}
{% tab title="Python" %}

```
import requests

endpoint = "https://api.ttapi.io/openai/v1/images/generations"

headers = {
    "TT-API-KEY": your_key
}

data = {
    "prompt": "a cute cat",
    "size": "1024x1024",
}

response = requests.post(endpoint, headers=headers, json=data)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node" %}

```
const axios = require('axios');

let config = {
  method: 'post',
  url: 'https://api.ttapi.io/openai/v1/images/generations',
  headers: { 
    'TT-API-KEY': 'your_key'
  },
  data : {
    "prompt": "a cute cat",
    "size": "1024x1024 "
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.status));
})
.catch(function (error) {
  console.log(error);
});
```

{% endtab %}
{% endtabs %}

#### 返回示例

{% hint style="info" %}
Dalle3 返回图片存在有效期限制，使用请自行转存图片
{% endhint %}

{% tabs %}
{% tab title="200" %}

```json
{
    "status": "SUCCESS",
    "message": "success",
    "data": {
        "created": 1713577682,
        "data": [
            {
                "revised_prompt": "A serene, domestic scene unfolding at dusk: a fluffy, long-haired tabby cat with piercing green eyes and distinctive black and white stripes curled up on a cozy, burgundy-colored velvet cushion. Around the cat is the warmth of a rustic country home, with wooden beams and a crackling fireplace. Light streams in through a large, arched window, painting the scene in the beautiful, ethereal light of golden hour.",
                "url": "https://dalleprodaue.blob.core.windows.net/private/images/cbb4adae-b889-4adf-9b84-4cd6d72d74fc/generated_00.png?se=2024-04-21T01%3A48%3A14Z&sig=th9fuLXfJVtLUOWu%2BfkJk1aY8abDZTDe7aIWJ1QzLkY%3D&ske=2024-04-26T13%3A43%3A10Z&skoid=f4f58869-78fa-4857-8a87-4ce5ae4ba8c3&sks=b&skt=2024-04-19T13%3A43%3A10Z&sktid=33e01921-4d64-4f8c-a055-5bdaffd5e33d&skv=2020-10-02&sp=r&spr=https&sr=b&sv=2020-10-02"
            }
        ]
    }
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "status": "FAILED",
    "message": "For the dall-e-3 model, \"size\" must be one of 1024x1024, 1792x1024, or 1024x1792.",
    "data": null
}
```

{% endtab %}
{% endtabs %}

## GPT-4o 生成图像

<mark style="color:green;">`POST`</mark> `https://api.ttapi.io/openai/4o-image/generations`

根据文本提示以及图片资源生成图片

{% hint style="info" %}
注意：由于openai目前暂未以api形式提供该接口，所以该接口目前为逆向接口。稳定性可能存在波动，目前整体定价较为便宜，后续官方正式上线后，可能会同步调整接口字段以及定价。
{% endhint %}

**Headers**

| Name         | Value                  |
| ------------ | ---------------------- |
| Content-Type | `application/json`     |
| TT-API-KEY   | `用于请求授权 TT-API 的API密钥` |

**Body**

<table><thead><tr><th width="166">参数</th><th width="107">类型</th><th width="169">是否必须</th><th>描述</th></tr></thead><tbody><tr><td><code>prompt</code></td><td>string</td><td>是</td><td>生成图片文字提示，因为目前为逆向模型，建议文案提示存在关键字：<strong>“画一张xxx”, “生成一张”，"draw a xxx"</strong>，具体语言不限制，openai本身就支持多语言模型，中文支持也非常友好。</td></tr><tr><td><code>referImages</code></td><td>array</td><td>否</td><td><p>垫图数组，示例：<br></p><pre class="language-json"><code class="lang-json"> [      "https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg",      "https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg"]
</code></pre></td></tr><tr><td><code>hookUrl</code></td><td>string</td><td>否</td><td>回调地址，任务完成或失败将通过请地址进行通知。如果未设置，则需要请求<a href="#gpt4o-sheng-cheng-jie-guo-cha-xun">fetch 接口</a>进行查询。</td></tr></tbody></table>

#### 请求示例

{% tabs %}
{% tab title="Python" %}

```
import requests

endpoint = "https://api.ttapi.io/openai/4o-image/generations"

headers = {
    "TT-API-KEY": your_key
}

data = {
    "prompt": "画一张美女模特该衣服平面照拍摄照片，要求高像素，高逼真度，完美还原衣服所有细节，全身照专业姿势，身材性感，穿着潮流，面带微笑，欧美女性皮肤白皙",
    "referImages": [
        "https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg"
    ],
    "hookUrl": "https://webhook-test.com/b129b43b6619f977b3227387fc290f7d"
}

response = requests.post(endpoint, headers=headers, json=data)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node" %}

```
const axios = require('axios');

let config = {
  method: 'post',
  url: 'https://api.ttapi.io/openai/v1/4o-image/generations',
  headers: { 
    'TT-API-KEY': 'your_key'
  },
  data : {
      "prompt": "画一张美女模特该衣服平面照拍摄照片，要求高像素，高逼真度，完美还原衣服所有细节，全身照专业姿势，身材性感，穿着潮流，面带微笑，欧美女性皮肤白皙",
      "referImages": [
          "https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg"
      ],
      "hookUrl": "https://webhook-test.com/b129b43b6619f977b3227387fc290f7d"
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.status));
})
.catch(function (error) {
  console.log(error);
});
```

{% endtab %}
{% endtabs %}

#### 返回示例

{% tabs %}
{% tab title="200" %}

```json
{
    "status": "SUCCESS",
    "message": "success",
    "data": {
        "jobId": "5ecc5080-b1d7-4b9f-8184-435e46ebb5cb"
    }
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "status": "FAILED",
    "message": "",
    "data": null
}
```

{% endtab %}
{% endtabs %}

## GPT-4o生成结果查询

<mark style="color:green;">`POST/GET`</mark> `https://api.ttapi.io/openai/4o-image/fetch`

获取GPT-4o生成任务结果，返回数据结构与[hookUrl](#gpt4o-yi-bu-xiang-ying-json-shi-li)中返回一致

**Headers**

| Name         | Value                  |
| ------------ | ---------------------- |
| Content-Type | `application/json`     |
| TT-API-KEY   | `用于请求授权 TT-API 的API密钥` |

**Query / Body**

<table><thead><tr><th width="178">参数</th><th width="108">类型</th><th width="116">是否必须</th><th>描述</th></tr></thead><tbody><tr><td>jobId</td><td>string</td><td>是</td><td>生成接口返回的jobId</td></tr></tbody></table>

#### 请求示例

{% tabs %}
{% tab title="Python" %}

```
import requests

endpoint = "https://api.ttapi.io/openai/4o-image/fetch"

headers = {
    "TT-API-KEY": your_key
}

data = {
    "jobId": "5ecc5080-b1d7-4b9f-8184-435e46ebb5cb"
}

response = requests.post(endpoint, headers=headers, json=data)

print(response.status_code)
print(response.json())
```

{% endtab %}
{% endtabs %}

## GPT-4o 异步响应JSON示例

{% tabs %}
{% tab title="ON\_QUEUE" %}

```
{
    "status": "ON_QUEUE",
    "message": null,
    "jobId": "0ccf0606-3f32-4090-85bd-1786e4593be5",
    "data": {
        "prompt": "画一张美女模特该衣服平面照拍摄照片，要求高像素，高逼真度，完美还原衣服所有细节，全身照专业姿势，身材性感，穿着潮流，面带微笑，欧美女性皮肤白皙",
        "referImages": [
            "https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg"
        ],
        "imageUrl": null,
        "quota": "2",
        "finishTime": null,
        "hookUrl": "https://webhook-test.com/b129b43b6619f977b3227387fc290f7d"
    }
}
```

{% endtab %}

{% tab title="SUCCESS" %}

```
{
  "status": "SUCCESS",
  "message": "success",
  "jobId": "5ecc5080-b1d7-4b9f-8184-435e46ebb5cb",
  "data": {
    "prompt": "画一张美女模特该衣服平面照拍摄照片，要求高像素，高逼真度，完美还原衣服所有细节，全身照专业姿势，身材性感，穿着潮流，面带微笑，欧美女性皮肤白皙",
    "referImages": [
      "https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg"
    ],
    "imageUrl": "https://cdnc.ttapi.io/2025-03-31/cd3f3ce5-06be-4b3a-9aed-014045ca1804.png",
    "quota": "2",
    "finishTime": "2025-03-31 04:25:33",
    "hookUrl": "https://webhook-test.com/b129b43b6619f977b3227387fc290f7d"
  }
}
```

{% endtab %}

{% tab title="FAILED" %}

```
{
  "status": "FAILED",
  "message": "job failed",
  "jobId": "b45fcf32-71a5-4df2-82c7-2e6300e32e29",
  "data": {
    "prompt": "画一张模特采光棚真实试衣场景，要求高像素，高逼真度，全身照专业姿势，中国模特美女，身材比例协调，面带微笑，皮肤白皙",
    "referImages": [
      "https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg"
    ],
    "imageUrl": null,
    "quota": "0",
    "finishTime": "2025-03-31 04:10:21",
    "hookUrl": "https://webhook-test.com/b129b43b6619f977b3227387fc290f7d"
  }
}
```

{% endtab %}
{% endtabs %}

## GPT-4o 使用案例

### 应用场景/实践案例：

* 制作海报（我的垫图可能不太恰当，随便官网首页截了个图，具体实际使用需要调试）

提示词：结合图片，生成一张GPT-4o宣传海报，要求海报简洁大气，存在TTAPI的logo，科技风格主题

<figure><img src="https://1799183090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FglZ8aTwvA9oRr34hM7MK%2Fuploads%2FjUGul3t43bXgSnM6cB5r%2Fimage.png?alt=media&#x26;token=a160118e-882e-4dde-a749-56c38ac4d3c7" alt="" width="563"><figcaption><p>结合图片，生成一张GPT-4o宣传海报，要求海报简洁大气，存在TTAPI的logo，科技风格主题</p></figcaption></figure>

<figure><img src="https://1799183090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FglZ8aTwvA9oRr34hM7MK%2Fuploads%2F0JYFJfFeonXptGenL6oX%2Fimage.png?alt=media&#x26;token=856abc44-946f-4bd6-9a4c-831109c7ad91" alt="" width="563"><figcaption></figcaption></figure>

* 文章插画

提示词：一张图详细解释马斯洛需求层次理论

<figure><img src="https://1799183090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FglZ8aTwvA9oRr34hM7MK%2Fuploads%2FBTzuko9VqzWQHM11xTFS%2Fimage.png?alt=media&#x26;token=99b7484e-cd88-4382-b4ae-93f4b944949a" alt="" width="375"><figcaption><p>一张图详细解释马斯洛需求层次理论</p></figcaption></figure>

* 模特试衣

提示词：画一张美女模特该衣服平面照拍摄照片，要求高像素，高逼真度，完美还原衣服所有细节，全身照专业姿势，身材性感，穿着潮流，面带微笑，欧美女性皮肤白皙

<figure><img src="https://1799183090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FglZ8aTwvA9oRr34hM7MK%2Fuploads%2FpFzKmM5ki2cRHVBCkGUz%2Fimage.png?alt=media&#x26;token=39ce8d0c-7dd7-4053-9211-bc4c96fd0e33" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="https://1799183090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FglZ8aTwvA9oRr34hM7MK%2Fuploads%2FfsBAlyjQd0lb6kCW0Y1Y%2Fimage.png?alt=media&#x26;token=0ea440f6-4c0d-47c0-95e7-239395324be7" alt="" width="375"><figcaption></figcaption></figure>

* 产品封面
* 小说插画
* 等等各种你能想到的复杂场景

### 总结：

OpenAI推出的这个4o图片模型在现在的AI市场里来说显然是一个王炸模型，个人觉得文生图不是他最强的所在，最强的关键点在于**改图**以及**垫图生图**

优点：

* **文本支持好。**&#x57FA;于OpenAI llm大模型语言理解能力强，文字支持友好不像其他图片模型的**鬼画符**或者需要**双引号+英文限制才会有概率**的在图片中贴上你想要的文本
* **垫图识图。**&#x652F;持依据文案加识别就可以更改上传图片中的元素，或者依据上传图片生成你想要的场景图，这一点目前没有任何全品类的图片模型可以做到

不足：

* **人物刻画。**&#x76EE;前尝试，人物的刻画能力与Midjourney对比来说会差一些，比如要求生成的任务客户到汗珠，皮肤纹理，发丝等等。
* **尺寸控制。**&#x76EE;前由于官方还未给出api，整体图片的尺寸很难通过提示词进行精准的控制
* **细节把控。**&#x76EE;前需要高精度的使用场景，很难做到细节的刻画与把控


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-zh.mjapiapp.com/api/openai-image-models.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
