Python aiohttp с NordRouter
python
import asyncio
import os
import aiohttp
async def main():
timeout = aiohttp.ClientTimeout(total=60)
headers = {"Authorization": f"Bearer {os.environ['NORDROUTER_API_KEY']}"}
body = {
"model": "anthropic/claude-sonnet-4.6",
"messages": [{"role": "user", "content": "Ответь: работает"}],
}
async with aiohttp.ClientSession(timeout=timeout) as session:
async with session.post(
"https://nordrouter.com/v1/chat/completions",
headers=headers,
json=body,
) as response:
response.raise_for_status()
data = await response.json()
print(data["choices"][0]["message"]["content"])
asyncio.run(main())