Skip to content

OpenRouter 聊天模型节点(OpenRouter Chat Model node)#

使用 OpenRouter 聊天模型节点,将 OpenRouter 的聊天模型与对话式代理结合使用。

🌐 Use the OpenRouter Chat Model node to use OpenRouter's chat models with conversational agents.

本页提供 OpenRouter 聊天模型节点的节点参数以及更多资源的链接。

🌐 On this page, you'll find the node parameters for the OpenRouter Chat Model node and links to more resources.

凭证

你可以在这里找到该节点的认证信息。

Parameter resolution in sub-nodes

Sub-nodes behave differently to other nodes when processing multiple items using an expression.

Most nodes, including root nodes, take any number of items as input, process these items, and output the results. You can use expressions to refer to input items, and the node resolves the expression for each item in turn. For example, given an input of five name values, the expression {{ $json.name }} resolves to each name in turn.

In sub-nodes, the expression always resolves to the first item. For example, given an input of five name values, the expression {{ $json.name }} always resolves to the first name.

节点参数(Node parameters)#

模型(Model)#

选择用于生成补全的模型。

🌐 Select the model to use to generate the completion.

n8n 会动态加载来自 OpenRouter 的模型,你只会看到你账户可用的模型。

🌐 n8n dynamically loads models from OpenRouter and you'll only see the models available to your account.

节点选项(Node options)#

使用这些选项来进一步细化节点的行为。

🌐 Use these options to further refine the node's behavior.

频率惩罚(Frequency Penalty)#

使用此选项可以控制模型重复自身的几率。较高的数值可以降低模型重复的可能性。

🌐 Use this option to control the chances of the model repeating itself. Higher values reduce the chance of the model repeating itself.

最大令牌数(Maximum Number of Tokens)#

请输入使用的最大令牌数,这将设置完成时长。

🌐 Enter the maximum number of tokens used, which sets the completion length.

响应格式(Response Format)#

选择 文本JSONJSON 确保模型返回有效的 JSON。

🌐 Choose Text or JSON. JSON ensures the model returns valid JSON.

在线惩罚(Presence Penalty)#

使用此选项可以控制模型谈论新话题的可能性。数值越高,模型谈论新话题的几率越大。

🌐 Use this option to control the chances of the model talking about new topics. Higher values increase the chance of the model talking about new topics.

采样温度(Sampling Temperature)#

使用此选项可以控制采样过程的随机性。较高的温度会产生更多样化的采样,但也增加了产生幻觉的风险。

🌐 Use this option to control the randomness of the sampling process. A higher temperature creates more diverse sampling, but increases the risk of hallucinations.

超时(Timeout)#

请输入最大请求时间(以毫秒为单位)。

🌐 Enter the maximum request time in milliseconds.

最大重试次数(Max Retries)#

请输入请求重试的最大次数。

🌐 Enter the maximum number of times to retry a request.

热门问题(Top P)#

使用此选项设置生成内容应使用的概率。使用较低的值可以忽略不太可能的选项。

🌐 Use this option to set the probability the completion should use. Use a lower value to ignore less probable options.

模板和示例(Templates and examples)#

Template widget placeholder.

由于 OpenRouter 与 OpenAI API 兼容,你可以参考 LangChains 的 OpenAI 文档 以获取有关该服务的更多信息。

🌐 As OpenRouter is API-compatible with OpenAI, you can refer to LangChains's OpenAI documentation for more information about the service.

View n8n's Advanced AI documentation.