DeepSeek-V3.2¶
以下API_KEY请前往令牌管理页面获取。
OpenAI 请求端点:https://www.autodl.art/api/v1/
curl调用¶
curl --location -g --request POST "https://www.autodl.art/api/v1/chat/completions" \
--header "Authorization: Bearer $API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
"messages": [
{
"role": "user",
"content": "您好!"
}
],
"model":"DeepSeek-V3.2",
"stream":true
}'
Python¶
# 如果没有安装OpenAI Python SDK,可使用命令安装:pip install OpenAI
from openai import OpenAI
# 初始化客户端
client = OpenAI(
base_url="https://www.autodl.art/api/v1",
api_key="YOUR_API_KEY",
)
# 调用接口(这里使用了stream=True进行流式响应)
stream = client.chat.completions.create(
model="DeepSeek-V3.2",
messages=[
{
"role": "user",
"content": "您好!"
}
],
stream=True,
)
# 流式打印输出
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content)