ai-business-write/技术文档/硅基流动大模型对话接口.md
2025-12-04 14:41:20 +08:00

666 B

硅基流动大模型对话API调用参考

import requests

url = "https://api.siliconflow.cn/v1/chat/completions"

payload = {
    "model": "deepseek-ai/DeepSeek-V3.2-Exp",
    "messages": [
        {
            "role": "user",
            "content": "What opportunities and challenges will the Chinese large model industry face in 2025?"
        }
    ]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())

model通常使用“deepseek-ai/DeepSeek-V3.2-Exp”

API key通常可以单独写在一个.env配置文件中并读取