> For AI agents: the complete documentation index is available at https://docs.reelway.ai/llms.txt, the full documentation bundle is available at https://docs.reelway.ai/llms-full.txt.

# AI 智能体

Reelway 对智能体是「OpenAI 兼容 + 生成 API」的组合:文本规划与工具循环走 [Intelligence 推理面](https://docs.reelway.ai/intelligence/introduction.md),媒体生产走 [rcn 生成面](https://docs.reelway.ai/api-reference/direct-generation.md),两者共用同一把 Key 与同一个余额。

## 最短路径

```js
import OpenAI from 'openai';
import { SogniClient } from '@reelway/client';

// 文本规划面
const llm = new OpenAI({ baseURL: 'https://api.reelway.ai/v1', apiKey: process.env.REELWAY_API_KEY });
// 媒体生产面(同一把 Key)
const sogni = await SogniClient.createInstance({ appId: 'agent-prod', network: 'fast', apiKey: process.env.REELWAY_API_KEY });

// 在智能体的工具实现里生成媒体:
const project = sogni.projects.create({ modelId: 'z_image_turbo_bf16', positivePrompt: '…' });
const urls = await project.waitForCompletion();
```

## 本节导览

- [你的第一张智能体图像](https://docs.reelway.ai/agents/first-result.md) —— 从 Key 到第一张结果
- [智能体鉴权](https://docs.reelway.ai/agents/authentication.md) —— Key 策略与限额
- [智能体计价与充值](https://docs.reelway.ai/agents/pricing.md) —— 扣费时点与成本隔离
- [智能体任务、资产与恢复](https://docs.reelway.ai/agents/jobs.md) —— 生命周期与断线恢复


### 建身份
为该智能体创建独立子 Key 并命名(如 `agent-prod`)。
### 接入
文本面改 `baseURL`;媒体面用 `@reelway/client` 或直调 REST/WS。
### 控成本
依赖单 Key 限额(`402`/`1013`)与幂等键,防失控重试。
