import requests
url = "http://localhost:3001/v1/completions"
headers = {"Authorization": "sk-fastgpt"}
data = {
"model": "deepseek-r1:7b",
"messages": [{"role": "system", "content": "你是一个AI助手"}, {"role": "user", "content": "你好"}]
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
请配合上一篇文章使用,如果你的FastGPT一直配不好但你怀疑One API没问题就运行一下吧。
url换成One API对应的localhost,model改成你在本地部署好的,要用One API调用的模型。Windows本地部署FastGPT请求One API报错捉虫,调用m3e与Ollama的模型