from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY_FROM_CLOUD_SILICONFLOW_CN",
base_url="https://api.siliconflow.cn/v1")
response = client.chat.completions.create(
# model='Pro/deepseek-ai/DeepSeek-R1',
model="Qwen/Qwen2.5-72B-Instruct",
messages=[
{'role': 'user',
'content': "What New Opportunities Will Inference Models Bring to the Market?"}
],
stream=True
)
for chunk in response:
if not chunk.choices:
continue
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
if chunk.choices[0].delta.reasoning_content:
print(chunk.choices[0].delta.reasoning_content, end="", flush=True)