AutoDL大模型服务API 请求端点和示例文档

张开发
2026/4/10 18:31:00 15 分钟阅读

分享文章

AutoDL大模型服务API 请求端点和示例文档
真的服了藏得很深文档很乱居然是独立的页面真的很难找到。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_urlhttps://www.autodl.art/api/v1, api_keyYOUR_API_KEY, ) # 调用接口这里使用了streamTrue进行流式响应 stream client.chat.completions.create( modelDeepSeek-V3.2, messages[ { role: user, content: 您好 } ], streamTrue, ) # 流式打印输出 for chunk in stream: if chunk.choices and chunk.choices[0].delta.content: print(chunk.choices[0].delta.content)

更多文章