langchain-learning/helloworld/helloworld.py
2026-04-12 17:39:33 +08:00

21 lines
471 B
Python

import requests
url = "https://api.siliconflow.cn/v1/chat/completions"
payload = {
"model": "Qwen/Qwen3.5-4B",
"messages": [
{
"role": "user",
"content": "你是谁"
}
]
}
headers = {
"Authorization": "Bearer sk-sylilrjrtxlvecwhfusjkutclmppzuzhncfcfxtekxrzyjee", #填写自己的api-key
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())