Skip to content

LiteLLM z NordRouter

Instalacja:

bash
pip install litellm
python
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)

Przedrostek openai/ wybiera adapter LiteLLM. NordRouter powinien otrzymać pozostały pełny identyfikator anthropic/claude-sonnet-4.6.

Jeśli widzisz w logach dodatkowy prefiks, sprawdź wersję LiteLLM i włączony tryb przesyłania ID modelu.

Oficjalne informacje:LiteLLM Docs.

Wszystkie programy