AI AgentOpenClaw

[OpenClaw] 切換本地模型

    1. 查看現有備份檔:ls ~/.openclaw/openclaw.json*
    2. 備份:cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.bak.X
  1. nano ~/.openclaw/openclaw.json
    尋找 (Ctrl + w) 並修改:

    1. primary: “<MODEL_NAME>”
    2. models“: {
        …, 
        <MODEL_NAME>“: {}
      }
    3. "models": {
        "mode": "merge",
        "providers": {
          "ollama": {
            ...
            "models": [
              ...,
              {
                "id": "<MODEL_NAME>",
                "name": "<MODEL_NAME>",
                "reasoning": true,
                "input": [
                  "text", "image"
                ],
                "cost": {
                  "input": 0,
                  "output": 0,
                  "cacheRead": 0,
                  "cacheWrite": 0
                },
                "contextWindow": 128000,
                "maxTokens": 8192,
                "compat": {
                  "supportsTools": true,
                  "supportsUsageInStreaming": true
                }
              }
            ]
            ...
          }
        }
      }
      1. reasoning: true:支援 Thinking Mode
      2. input: ["text", "image"]:接受的輸入類型
      3. supportsTools: true
        支援 function calling,讓模型能夠主動呼叫外部工具
      4. supportsUsageInStreaming: true
        串流回應時同時回報 token 使用量,方便監控和計費
      5. token :=
        語言模型的最小處理單位
        由分詞器(tokenizer)將原始語句/文章切割形成
        是介於字元 (character) 與單詞 (word) 之間的子詞 (subword) 片段

        1. contextWindow:上下文視窗的 token 上限
        2. maxTokens:單次回應可輸出的 token 上限
    4. 重啟 container:docker restart <CONTAINER_ID>

Last Updated on 2026/05/20 by A1go

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *