参数
请参阅 插件通用配置 了解所有插件可用的配置选项。
provider
string
required
vaild vaule:
openai,deepseek,azure-openai,aimlapi,gemini,vertex-ai,anthropic,openrouter,openai-compatibleLLM 服务提供商。
当设置为
openai时,插件将代理请求到https://api.openai.com/chat/completions。当设置为
deepseek时,插件将代理请求到https://api.deepseek.com/chat/completions。当设置为
gemini(API7 企业版 3.9.3 及更高版本)时,插件将代理请求到https://generativelanguage.googleapis.com/v1beta/openai/chat/completions。如果你代理请求到嵌入模型,则应在override中配置嵌入模型端点。当设置为
vertex-ai(API7 企业版 3.9.3 及更高版本)时,插件代理请求到 Google Cloud Vertex AI。对于聊天补全,插件将代理请求 到https://{region}-aiplatform.googleapis.com/v1beta1/projects/{project_id}/locations/{region}/endpoints/openapi/chat/completions。对于嵌入,插件将代理请求到https://{region}-aiplatform.googleapis.com/v1/projects/{project_id}/locations/{region}/publishers/google/models/{model}:predict。这些需要配置provider_conf中的project_id和region。或者,你可以配置override以使用自定义端点。当设置为
anthropic(API7 企业版 3.9.2 及更高版本)时,插件将代理请求到https://api.anthropic.com/v1/chat/completions。当设置为
openrouter(API7 企业版 3.9.2 及更高版本)时,插件将代理请求到https://openrouter.ai/api/v1/chat/completions。当设置为
aimlapi时,插件使用 OpenAI 兼容的驱动程序,默认将请求代理到https://api.aimlapi.com/v1/chat/completions。此参数从 APISIX 3.15.0 版本和 API7 企业版 3.8.17 版本开始可用。当设置为
openai-compatible时,插件代理请求到override中配置的自定义端点。当设置为
azure-openai时,插件也会代理请求到override中配置的自定义端点,并且另外从用户请求中移除model参数。auth
object
required
认证配置。
header
object
认证头。
header和query中至少应配置一个。query
object
认证查询参数。
header和query中至少应配置一个。gcp
object
Vertex AI 的 GCP 服务账号认证。在 API7 企业版 3.9.3 及更高版本中可用,APISIX 中不可用。
service_account_json
string
用于认证的 GCP 服务账号 JSON 内容。可以使用此参数配置,也可以通过设置
GCP_SERVICE_ACCOUNT环境变量来配置。max_ttl
integer
GCP 访问令牌缓存的最大 TTL(以秒为单位)。
expire_early_secs
integer
default:
60访问令牌在其实际过期时间之前过期的秒数。这可以防止令牌在活动请求期间过期的边缘情况。
options
object
模型配置。
除了
model之外,你还可以配置其他参数,它们将作为请求体转发到上游 LLM 服务。例如,如果你正在使用 OpenAI,你可以配置temperature、top_p和stream等其他参数。有关更多可用选项,请参阅你的 LLM 提供商的 API 文档。model
string
LLM 模型的名称,例如
gpt-4或gpt-3.5。有关更多可用模型,请参阅你的 LLM 提供商的 API 文档。
provider_conf
object
提供商特定的配置。当
provider为vertex-ai时,应配置provider_conf或override之一。在 API7 企业版 3.9.3 及更高版本中可用,APISIX 中不可用。
project_id
string
required
Vertex AI 的 Google Cloud 项目 ID。
region
string
required
Vertex AI 的 Google Cloud 区域。
override
object
覆盖设置。
endpoint
string
LLM 提供商端点。当
provider为openai-compatible时必填。
timeout
integer
default:
30000vaild vaule:
大于或等于 1
请求 LLM 服务时的请求超时时间(以毫秒为单位)。
keepalive
boolean
default:
true如果为 true,则在请求 LLM 服务时保持连接处于活动状态。
keepalive_timeout
integer
default:
60000vaild vaule:
大于或等于 1000
请求 LLM 服务时的请求超时时间(以毫秒为单位)。
keepalive_pool
integer
default:
30连接 LLM 服务时的 Keepalive 连接池大小。
ssl_verify
boolean
default:
true如果为 true,则验证 LLM 服务的证书。