File size: 511 Bytes
f5b0cd7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from dotenv import load_dotenv
from openai import AsyncOpenAI
import os
import asyncio

load_dotenv()

client = AsyncOpenAI(
    api_key=os.getenv("QWEN_API_KEY"),
    base_url="https://portal.qwen.ai/v1"
)

async def test():
    try:
        r = await client.chat.completions.create(
            model="qwen3-coder-plus",
            messages=[{"role": "user", "content": "ping"}]
        )
        print(r.choices[0].message.content)
    except Exception as e:
        print("ERROR:", e)

asyncio.run(test())