OpenRouter 模型通过 OpenRouter 提供对各种语言模型的统一访问。

参数类型默认值描述
idstr"gpt-4o"用于生成响应的具体模型 ID。
namestr"OpenRouter"OpenRouter 代理的名称标识符。
providerstr"OpenRouter:"+id模型提供者,结合了 "OpenRouter" 和模型 ID。
api_keyOptional[str]-用于向 OpenRouter 服务进行请求身份验证的 API 密钥。从环境变量 OPENROUTER_API_KEY 中检索。
base_urlstr"https://openrouter.ai/api/v1"向 OpenRouter 服务发出 API 请求的基础 URL。
max_tokensint1024响应中要生成的最大 token 数。