# AI Prompt Template 配置选项

ai-prompt-template 插件支持以“填空”方式为发送给 LLM 的用户输入使用预配置模板，从而简化 API 管理。<!-- --> <!-- -->配置涵盖插件参数。

## 参数[​](#参数 "参数的直接链接")

有关所有插件均可使用的配置项，请参阅[插件通用配置](https://docs.apiseven.com/apisix/reference/plugin-common-configurations.md)。

* templates

  array\[object]

  必填

  ***

  模板数组。

  * name

    string

    必填

    ***

    模板名称。请求路由时，请求应包含与配置的模板对应的模板名称。

  * template

    object

    必填

    ***

    模板规范。

    * model

      string

      ***

      LLM 模型名称，例如 `gpt-4` 或 `gpt-3.5`。更多可用模型请参见你的模型服务提供方 API 文档。

    * messages

      array\[object]

      ***

      模板消息规范。

      * role

        string

        必填

        有效值：

        `system`、`user` 或 `assistant`

        ***

        消息角色。

      * content

        string

        必填

        ***

        消息内容（提示词）。

* max\_req\_body\_size

  integer

  默认值：`67108864`

  有效值：

  大于或等于 1

  ***

  缓冲到内存中的请求体最大字节数。超过该上限的请求体会在模板处理前以 HTTP 400 被拒绝。自 API7 企业版 3.9.17 和 3.10.4，以及 APISIX 3.18.0 起可用。
