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

# GPT Image 接口参考

> OpenAI gpt-image-1/2 文生图与图片编辑蒙版接口

## 编辑 image

`POST /v1/images/edits`

给定一个提示，该模型将返回一个或多个预测的完成，并且还可以返回每个位置的替代标记的概率。

为提供的提示和参数创建完成

官方文档：[https://platform.openai.com/docs/api-reference/images/createEdit](https://platform.openai.com/docs/api-reference/images/createEdit)

### 请求参数 (Query / Path)

<ParamField header="Authorization" type="string">
  Bearer API Key
</ParamField>

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1/images/edits" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "\n\nHello there, how may I assist you today?",
        "role": "assistant"
      }
    }
  ],
  "created": 1677652288,
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "usage": {
    "completion_tokens": 12,
    "prompt_tokens": 9,
    "total_tokens": 21
  }
}
```

***

## 创建 Image

`POST /v1/images/generations`

[图片](https://platform.openai.com/docs/api-reference/images)

给定提示和/或输入图像，模型将生成新图像。

相关指南：[图像生成](https://platform.openai.com/docs/guides/images)

根据提示创建图像。

### 请求参数 (Query / Path)

<ParamField header="Authorization" type="string">
  Bearer API Key
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "model": "dall-e-2",
  "n": 1,
  "prompt": "A cute baby sea otter",
  "size": "1024x1024"
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1/images/generations" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "dall-e-2",
  "n": 1,
  "prompt": "A cute baby sea otter",
  "size": "1024x1024"
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "created": 1710000000,
  "data": [
    {
      "revised_prompt": "",
      "url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxx.png?Expires=xxx"
    }
  ]
}
```

***


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