You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
497 B

from openai import OpenAI
# 直接把你的 DeepSeek 密钥填在这里
client = OpenAI(
api_key="sk-0f12f1d7a48f4fb3b305a66f2948bfb9",
base_url="https://api.deepseek.com/v1",
)
if __name__ == "__main__":
stream = client.chat.completions.create(
model="deepseek-chat",
messages=[{"role": "user", "content": "用三句话解释量子纠缠"}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")
print()