简单LLM 通过 NordRouter
设置:
bash
pip install litellmpython
import os
from litellm import completion
response = completion(
model="openai/anthropic/claude-sonnet-4.6",
api_base="https://nordrouter.com/v1",
api_key=os.environ["NORDROUTER_API_KEY"],
messages=[{"role": "user", "content": "Ответь: работает"}],
)
print(response.choices[0].message.content)预先字母 openai/ 选择了LiteLLM适配器. NordRouter 必须获得其余的完整ID anthropic/claude-sonnet-4.6.
如果您的logs显示了余额的前,请检查LiteLLM版本和启用Model ID传输模式.
官方的信息:LiteLLM Docs.