Python so'rovlari NordRouter bilan
bash
pip install requestspython
import os
import requests
response = requests.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": "Ответь: работает"}],
},
timeout=60,
)
response.raise_for_status()
print(response.json()["choices"][0]["message"]["content"])Har doim timeout ni bosing va raise_for_status() ni chaqiring: aks holda HTTP-g'alati JSONni aniqlashda xatoga aylanishi mumkin.