# 图像图像图像图像

Canonical URL: https://developers.iagenify.com/zh/sdk/ref/tools/image/
Language: zh

`tools: { image: api.tools.image }, model: { main, image }`

由运行生成图像。它是针对一个名为图像的示范会话而解决的宣言,因此写作的模型不是绘制的模型。

Status: declaration only · needs an image session · declared cost 26

产生图像的是一个 [模拟会议](/zh/sdk/ref/models/create) 创建并交给了以此名称运行的 `image`.

## 声明 {#declaring}

```javascript
const writer = await api.models.create({ model: "gemini-3.5-flash" });
const painter = await api.models.create({ model: "gemini-3.1-flash-image" });

const agent = api.agents.create({
  model: { main: writer, image: painter },     // the name matters
  tools: { image: api.tools.image },
  budget: 200,
});

const run = await agent.run({
  inputs: [{ type: "text", content: "Draw a logo for a tide-forecasting app, then describe it." }],
});
```

> **会话的名称是图像, 而不是您所说的工具**
>
> 您可以自由地重新命名工具; 会话由内建文件自己的名称来查看。 没有模型中的图像条目, 运行答案没有提供图像会话, 而不是用写作模型来生成, 但它说这样的话 。

## 模型发送的内容 {#arguments}

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `prompt` | string | 必填 | 整个描述,在一个论点中 |

## 图像到哪里去 {#result}

它作为文物附在跑步的后面,在跑步的结果中——没有写在任何地方。保存它是你的,就是让同一跑步的网页、机器上的档案或桶子上。

```javascript
const [picture] = run.artifacts.filter((a) => a.type === "image");

await pc.files.write("Assets/logo.png", Buffer.from(picture.content, "base64"));
// or
await api.files.create({ name: "logo.png", content: Buffer.from(picture.content, "base64"),
                         mimeType: picture.mime }).save();
```

## 申报成本为26,高估 {#cost}

预算警卫决定 **之前** 使用已宣布的号码,该号码必须等于或高于该代实际成本多少。 26是默认值, 以 `cost` 如果你用更昂贵的模式工作 并且永远不会降低预算

```javascript
tools: {
  image: { run: api.tools.image, cost: 40, options: { aspectRatio: "16:9" } },
}
```

`options` 将此项号召合并到会话的设置中,这样固定的侧边比例或质量就可以固定,而不将主题从模型中移走。

## 收取的 {#billing}

一代人和其他人一样被记在账户账上,而博爱的信用总额也随之而来。 警卫拒绝时,不收费,因为电话从不响。 即便如此,他们也只能向银行行行长报告。

## 该公司为视频工具提供视频 {#sequel}

运行中的最新图像文物传递到 [视频视频](/zh/sdk/ref/tools/video) 画画它,然后动画它。 这两通电话, 中间你什么都没有。

- [视频视频](/zh/sdk/ref/tools/video): 剪辑,可以从此图像开始。
- [create_image](/zh/sdk/agent/tools/create-image): 本地引擎版本, 为你撰写文件 。
- [api.tools](/zh/sdk/ref/tools): 十五个,用它们的两个方法

```python
writer = api.models.create(model="gemini-3.5-flash")
painter = api.models.create(model="gemini-3.1-flash-image")

agent = api.agents.create(
    model={"main": writer, "image": painter},   # the name matters
    tools={"image": api.tools.image},
    budget=200,
)

run = agent.run(inputs=[
    {"type": "text", "content": "Draw a logo for a tide-forecasting app, then describe it."},
])
```

```python
import base64

picture = next(a for a in run["artifacts"] if a["type"] == "image")

pc.files.write("Assets/logo.png", base64.b64decode(picture["content"]))
# or
api.files.create(name="logo.png", content=base64.b64decode(picture["content"]),
                 mime_type=picture.get("mime")).save()
```

```python
tools = {
    "image": {"run": api.tools.image, "cost": 40, "options": {"aspectRatio": "16:9"}},
}
```
