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

# 使用指南

> 绑定配置、模板映射、沙箱与 API 调用。

## 绑定类型

* **OpenAI (HTTP)**：适配 OpenAI Compatible 协议

<img src="https://mintcdn.com/rokid/Wgtleya7-PwOAy0O/images/image-1.png?fit=max&auto=format&n=Wgtleya7-PwOAy0O&q=85&s=ea54e7875a59f631ebf2681b09c0b430" alt="Image" width="2682" height="1426" data-path="images/image-1.png" />

* **Custom (HTTP)**：通过模板映射任意 HTTP/JSON 接口

<img src="https://mintcdn.com/rokid/Wgtleya7-PwOAy0O/images/image-2.png?fit=max&auto=format&n=Wgtleya7-PwOAy0O&q=85&s=2496ef317c3cd19664913ad505bab39e" alt="Image" width="2654" height="1432" data-path="images/image-2.png" />

## 自定义模板

### 请求模板（Request Template）

```json theme={null}
{
  "model": "my-model",
  "messages": [
    { "role": "user", "content": "{{message.0.text}}" }
  ],
  "stream": true
}
```

### 响应模板（Response Template）

```json theme={null}
{
  "answer": "{{choices.0.delta.content}}",
  "is_finish": "{{choices.0.finish_reason}}"
}
```

> `is_finish` 可与 `finishMatchValue` 配合（如 `stop`）判断结束。

## 沙箱（Sandbox）

* **Trace**：请求处理耗时与关键步骤
* **Raw Response**：目标接口原始返回
* **Transformed Preview**：转换后的 Rokid Rizon 灵珠智能体开发平台格式响应

<img src="https://mintcdn.com/rokid/Wgtleya7-PwOAy0O/images/image.png?fit=max&auto=format&n=Wgtleya7-PwOAy0O&q=85&s=9110a77cbf53e830720a208e1db62d60" alt="Image" width="2610" height="1422" data-path="images/image.png" />

## Bridge API

```http theme={null}
POST /api/bridge/{agentId}
Authorization: Bearer <settings.json 中的 apiKey>
Content-Type: application/json

{
  "message_id": "msg_123",
  "agent_id": "agent_123",
  "message": [
    { "role": "user", "type": "question", "text": "你好" }
  ]
}
```

返回为 SSE 流式：

```
event: message
data: {"role":"agent","type":"answer","answer_stream":"...","message_id":"msg_123","agent_id":"agent_123","is_finish":false}
```
