20 lines
552 B
Python
20 lines
552 B
Python
# Please install OpenAI SDK first: `pip3 install openai`
|
|
import os
|
|
from openai import OpenAI
|
|
|
|
client = OpenAI(
|
|
api_key=os.environ.get('DEEPSEEK_API_KEY'),
|
|
base_url="https://api.deepseek.com")
|
|
|
|
response = client.chat.completions.create(
|
|
model="deepseek-v4-pro",
|
|
messages=[
|
|
{"role": "system", "content": "You are a helpful assistant"},
|
|
{"role": "user", "content": "Hello"},
|
|
],
|
|
stream=False,
|
|
reasoning_effort="high",
|
|
extra_body={"thinking": {"type": "enabled"}}
|
|
)
|
|
|
|
print(response.choices[0].message.content) |