gpt4all接口api调用示例20250330

gpt4all接口api调用示例20250330
官方示意文档: https://docs.gpt4all.io/gpt4all_api_server/home.html#localdocs-integration

curl --request POST \
  --url http://localhost:8899/v1/chat/completions \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "DeepSeek-R1-Distill-Qwen-7B-Q3_0.gguf",
    "messages": [{"role": "user", "content": "作一首简单的爱情诗。"}],
    "max_tokens": 5000000,
    "temperature": 1
}'

——————————————————————————————————————————————————————————————————————

import requests

url = "http://localhost:8899/v1/chat/completions"
headers = {"Content-Type": "application/json"}
data = {
    "model": "gpt4all-falcon-q4_0",
    "messages": [{"role": "user", "content": "解释下vlan的优点"}],
    "max_tokens": 50000000,
    "temperature": 1,
}
response = requests.post(url, json=data, headers=headers)
print(response.json()["choices"][0]["message"]["content"])


posted on 2025-03-30 12:13  我,在等待  阅读(125)  评论(0)    收藏  举报