Python HTTPX с NordRouter
python
import os
import httpx
with httpx.Client(timeout=60) as client:
response = client.post(
"https://nordrouter.com/v1/chat/completions",
headers={"Authorization": f"Bearer {os.environ['NORDROUTER_API_KEY']}"},
json={
"model": "anthropic/claude-sonnet-4.6",
"messages": [{"role": "user", "content": "Привет!"}],
},
)
response.raise_for_status()
print(response.json()["choices"][0]["message"]["content"])Для httpx.AsyncClient параметры запроса те же, но вызовы выполняются через await.