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

# 图像生成

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

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

### 示例

```ruby theme={null}
require 'phaseo_sdk'

client = PhaseoSdk::Phaseo.new(api_key: ENV.fetch("PHASEO_API_KEY"))
image = client.generate_image(
  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`


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