> ## 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.

# 图像生成

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

**方法**：`$client->generateImage(...)`

### 示例

```php theme={null}
<?php

require 'vendor/autoload.php';

use Phaseo\Sdk\Phaseo;

$client = new Phaseo(getenv('PHASEO_API_KEY'));
$response = $client->generateImage([
    'model' => 'openai/gpt-image-1',
    'prompt' => 'A lighthouse at golden hour',
    'size' => '1024x1024',
    'n' => 1,
    'response_format' => 'url'
]);
echo $response['data'][0]['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


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