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

# 图像生成

> 使用 TypeScript SDK 调用 /images/generations。

**方法**：`client.generateImage()`。

### 示例

```typescript theme={null}
const image = await client.generateImage({
  model: "openai/gpt-image-1",
  prompt: "A lighthouse at golden hour",
  size: "1024x1024",
  n: 1,
  response_format: "url",
});
```

### 关键参数

* `model`（必填）：支持图像的模型 ID（例如 `openai/gpt-image-1`）。
* `prompt`（必填）：提示文本。
* `n`（1–10）：要生成的图像数量。
* `size`：例如 `1024x1024`、`1024x1792`、`1792x1024`。
* `quality`：`standard` 或 `hd`（取决于模型）。
* `style`：例如 `vivid` 或 `natural`（取决于模型）。
* `response_format`：`url` 或 `b64_json`。
* `user`：用于安全和滥用跟踪的可选终端用户标记。

### 返回值

`ImageGenerationResponse`

```json theme={null}
{
  "data": [
    {
      "url": "https://example.com/generated_image.png"
    }
  ]
}
```


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