OpenAI请求

本文展示了两个使用curl调用AI模型API的示例。第一个示例向OpenAI兼容接口发送请求,使用glm-4-air模型询问月亮高度;第二个示例向本地Ollama服务发送请求,使用llama3.2模型询问天空为什么是蓝色。同时提供了Ollama官网和GitHub仓库链接。

作者:zhuge···预计阅读 2 分钟·603 阅读·0 评论
OpenAI请求
curl --location --request POST 'https://openai.xxx.com/v1/chat/completions' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer sk-xxxxx' \
--data-raw '{
    "model": "glm-4-air",
    "messages": [
      {
        "role": "user",
        "content": "月亮有多高!"
      }
    ]
  }'

https://ollama.com/ https://github.com/ollama/ollama

curl http://localhost:11434/api/chat -d '{
  "model": "llama3.2",
  "messages": [
    { "role": "user", "content": "why is the sky blue?" }
  ]
}'

相关文章

评论

加载中...