Oct 22

Ollama API example 不指定

felix021 @ 2025-10-22 18:48 [随想] 评论(0) , 引用(0) , 阅读(196) | Via 本站原创 | |
引用

curl -X POST http://localhost:11434/api/chat \
  -H "Content-Type: application/json" \
  -d '{
    "model": "hf.co/Triangle104/Qwen3-30B-A3B-abliterated-Q5_K_M-GGUF:Q5_K_M",
    "messages": [
      {
        "role": "user",
        "content": "Pourquoi le ciel est-il bleu? Reponds en anglais, svp."
      }
    ],
    "options": {
      "num_ctx": 40960
    },
    "stream": false
  }'





# HOWTO

1. 让模型一直加载在内存/显存中

$ vi /etc/systemd/system/ollama.service

增加配置 Environment="OLLAMA_KEEP_ALIVE=-1"

然后 service ollama restart ,加载模型后 ollama ps 看 UTIL 列,值是 Forever 说明生效了。

2. 改变监听的 IP、端口 允许来自外部的请求

新增环境变量

- 允许来自外部的请求:

OLLAMA_HOST=0.0.0.0

- 更换端口:

OLLAMA_HOST=0.0.0.0:8080





欢迎扫码关注:




转载请注明出自 ,如是转载文则注明原出处,谢谢:)
RSS订阅地址: https://www.felix021.com/blog/feed.php
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   *非必须
网址   电邮   [注册]