参数
请参阅 插件通用配置 了解所有插件可用的配置选项。
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