knowledge-vault/discussions/technology/OpenClaw/初始化工作/继续解决401.md

30 KiB
Raw Permalink Blame History

我已经升级到最新的版本2026.3.8

配置文件APIKEY我省略了

    "minimax-cn": {
        "baseUrl": "https://api.minimaxi.com/anthropic",
        "apiKey": "sk-cp-6co6v...UKzbk",
        "api": "anthropic-messages",
        "authHeader": true,
        "models": [
          {
            "id": "MiniMax-M2.5",
            "name": "MiniMax M2.5",
            "reasoning": true,
            "input": [
              "text"
            ],
            "cost": {
              "input": 15,
              "output": 60,
              "cacheRead": 2,
              "cacheWrite": 10
            },
            "contextWindow": 200000,
            "maxTokens": 8192
          },
          {
            "id": "MiniMax-M2.5-highspeed",
            "name": "MiniMax M2.5 Highspeed",
            "reasoning": true,
            "input": [
              "text"
            ],
            "cost": {
              "input": 15,
              "output": 60,
              "cacheRead": 2,
              "cacheWrite": 10
            },
            "contextWindow": 200000,
            "maxTokens": 8192
          }
        ]
      }
      ...

  "agents": {
    "defaults": {
      "model": {
        "primary": "minimax-cn/MiniMax-M2.5"
      },
      "models": {
        "minimax-cn/MiniMax-M2.5": {
          "alias": "Minimax"
        }
      },
      "workspace": "/root/.openclaw/workspace",
      "compaction": {
        "mode": "safeguard"
      },
      "maxConcurrent": 4,
      "subagents": {
        "maxConcurrent": 8
      }
    },
    ...

我检查APIKEY在Cherry Studio和Dify中都能正常使用。


执行openclaw models status

🦞 OpenClaw 2026.3.8 (3caab92) — I'm the assistant your terminal demanded, not the one your sleep schedule requested.

Config        : ~/.openclaw/openclaw.json
Agent dir     : ~/.openclaw/agents/main/agent
Default       : minimax-cn/MiniMax-M2.5
Fallbacks (0) : -
Image model   : -
Image fallbacks (0): -
Aliases (1)   : Minimax -> minimax-cn/MiniMax-M2.5
Configured models (1): minimax-cn/MiniMax-M2.5

Auth overview
Auth store    : ~/.openclaw/agents/main/agent/auth-profiles.json
Shell env     : off
Providers w/ OAuth/tokens (0): -
- minimax effective=profiles:~/.openclaw/agents/main/agent/auth-profiles.json | profiles=1 (oauth=0, token=0, api_key=1) | minimax:default=sk-cp-6c...uYVUKzbk
- minimax-cn effective=profiles:~/.openclaw/agents/main/agent/auth-profiles.json | profiles=1 (oauth=0, token=0, api_key=1) | minimax-cn:default=sk-cp-6c...uYVUKzbk | models.json=sk-cp-6c...uYVUKzbk | source=models.json: ~/.openclaw/agents/main/agent/models.json
- moonshot effective=models.json:sk-BGYJr...KWhRIcQp | models.json=sk-BGYJr...KWhRIcQp | source=models.json: ~/.openclaw/agents/main/agent/models.json
- qwen effective=models.json:sk-b5d4e...98d3abea | models.json=sk-b5d4e...98d3abea | source=models.json: ~/.openclaw/agents/main/agent/models.json

OAuth/token status
- none

执行了openclaw status --all


🦞 OpenClaw 2026.3.8 (3caab92) — Pairing codes exist because even bots believe in consent—and good security hygiene.

│
OpenClaw status --all

Overview
┌─────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Item            │ Value                                                                                                                                                                                                                                                                                                │
├─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Version         │ 2026.3.8                                                                                                                                                                                                                                                                                             │
│ OS              │ linux 6.6.117-45.1.oc9.x86_64 (x64)                                                                                                                                                                                                                                                                  │
│ Node            │ 22.22.0                                                                                                                                                                                                                                                                                              │
│ Config          │ ~/.openclaw/openclaw.json                                                                                                                                                                                                                                                                            │
│ Dashboard       │ http://10.2.0.3:18789/                                                                                                                                                                                                                                                                               │
│ Tailscale       │ off                                                                                                                                                                                                                                                                                                  │
│ Channel         │ stable (default)                                                                                                                                                                                                                                                                                     │
│ Update          │ pnpm · npm latest 2026.3.8                                                                                                                                                                                                                                                                           │
│ Gateway         │ local · ws://127.0.0.1:18789 (local loopback) · reachable 17ms · auth token                                                                                                                                                                                                                          │
│ Security        │ Run: openclaw security audit --deep                                                                                                                                                                                                                                                                  │
│ Gateway self    │ VM-0-3-opencloudos (10.2.0.3) app 2026.3.8 linux 6.6.117-45.1.oc9.x86_64                                                                                                                                                                                                                             │
│ Gateway service │ systemd installed · enabled · running (pid 3869459)                                                                                                                                                                                                                                                  │
│ Node service    │ systemd not installed                                                                                                                                                                                                                                                                                │
│ Agents          │ 3 total · 3 bootstrapping · 1 active · 3 sessions                                                                                                                                                                                                                                                    │
└─────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Channels
┌──────────┬─────────┬────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Channel  │ Enabled │ State  │ Detail                                                                                                                                                                                                                                                                                   │
├──────────┼─────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
└──────────┴─────────┴────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Agents
┌─────────────────────┬────────────────┬──────────┬──────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Agent               │ Bootstrap file │ Sessions │ Active   │ Store                                                                                                                                                                                                                                                     │
├─────────────────────┼────────────────┼──────────┼──────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ main                │ PRESENT        │        1 │ 13h ago  │ ~/.openclaw/agents/main/sessions/sessions.json                                                                                                                                                                                                            │
│ shirleen (shirleen) │ PRESENT        │        1 │ 9h ago   │ ~/.openclaw/agents/shirleen/sessions/sessions.json                                                                                                                                                                                                        │
│ wantsong (wantsong) │ PRESENT        │        1 │ 7m ago   │ ~/.openclaw/agents/wantsong/sessions/sessions.json                                                                                                                                                                                                        │
└─────────────────────┴────────────────┴──────────┴──────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Diagnosis (read-only)

Gateway connection details:
  Gateway target: ws://127.0.0.1:18789
  Source: local loopback
  Config: /root/.openclaw/openclaw.json
  Bind: lan

✓ Config: /root/.openclaw/openclaw.json
✓ Restart sentinel: none
! Port 18789
  Port 18789 is already in use.
  - pid 3869459 root: openclaw-gateway (*:18789)
  - Gateway already running locally. Stop it (openclaw gateway stop) or use a different port.
! Tailscale: off · unknown
  error: Error: spawn tailscale ENOENT
✓ Skills: 14 eligible · 0 missing · /root/.openclaw/workspace
✓ Channel issues (none)

执行openclaw doctor --fix

┌  OpenClaw doctor
│
◇  Startup optimization ─────────────────────────────────────────────────────────────────────╮
│                                                                                            │
│  - NODE_COMPILE_CACHE is not set; repeated CLI runs can be slower on small hosts (Pi/VM).  │
│  - OPENCLAW_NO_RESPAWN is not set to 1; set it to avoid extra startup overhead from        │
│    self-respawn.                                                                           │
│  - Suggested env for low-power hosts:                                                      │
│    export NODE_COMPILE_CACHE=/var/tmp/openclaw-compile-cache                               │
│    mkdir -p /var/tmp/openclaw-compile-cache                                                │
│    export OPENCLAW_NO_RESPAWN=1                                                            │
│                                                                                            │
├────────────────────────────────────────────────────────────────────────────────────────────╯
│
◇  State integrity ───────────────────────────────────────────────────────────────╮
│                                                                                 │
│  - OAuth dir not present (~/.openclaw/credentials). Skipping create because no  │
│    WhatsApp/pairing channel config is active.                                   │
│                                                                                 │
├─────────────────────────────────────────────────────────────────────────────────╯
│
◇  Gateway runtime ───────────────────────────────────────────────────────────────────────╮
│                                                                                         │
│  System Node 22+ not found. Install via Homebrew/apt/choco and rerun doctor to migrate  │
│  off Bun/version managers.                                                              │
│                                                                                         │
├─────────────────────────────────────────────────────────────────────────────────────────╯
│
◇  Gateway service config ───────────────────────────────────────────────────────────────╮
│                                                                                        │
│  - Gateway service uses Node from a version manager; it can break after upgrades.      │
│    (/root/.nvm/versions/node/v22.22.0/bin/node)                                        │
│  - System Node 22+ not found; install it before migrating away from version managers.  │
│                                                                                        │
├────────────────────────────────────────────────────────────────────────────────────────╯

Installed systemd service: /root/.config/systemd/user/openclaw-gateway.service
Previous unit backed up to: /root/.config/systemd/user/openclaw-gateway.service.bak
│
◇  Security ───────────────────────────────────────────────────────────────────────────╮
│                                                                                      │
│  - WARNING: Gateway bound to "lan" (0.0.0.0) (network-accessible).                   │
│    Ensure your auth credentials are strong and not exposed.                          │
│    Safer remote access: keep bind loopback and use Tailscale Serve/Funnel or an SSH  │
│    tunnel.                                                                           │
│    Example tunnel: ssh -N -L 18789:127.0.0.1:18789 user@gateway-host                 │
│    Docs: https://docs.openclaw.ai/gateway/remote                                     │
│  - Run: openclaw security audit --deep                                               │
│                                                                                      │
├──────────────────────────────────────────────────────────────────────────────────────╯
│
◇  Skills status ────────────╮
│                            │
│  Eligible: 14              │
│  Missing requirements: 43  │
│  Blocked by allowlist: 0   │
│                            │
├────────────────────────────╯
│
◇  Plugins ──────╮
│                │
│  Loaded: 5     │
│  Disabled: 33  │
│  Errors: 0     │
│                │
├────────────────╯
│
◇  
│
◇  Gateway ──────────────╮
│                        │
│  Gateway not running.  │
│                        │
├────────────────────────╯
│
◇  Gateway connection ────────────────────╮
│                                         │
│  Gateway target: ws://127.0.0.1:18789   │
│  Source: local loopback                 │
│  Config: /root/.openclaw/openclaw.json  │
│  Bind: lan                              │
│                                         │
├─────────────────────────────────────────╯
│
◇  Memory search ───────────────────────────────────────────────────────────────────────────╮
│                                                                                           │
│  Memory search is enabled but no embedding provider is configured.                        │
│  Semantic recall will not work without an embedding provider.                             │
│                                                                                           │
│                                                                                           │
│  Fix (pick one):                                                                          │
│  - Set OPENAI_API_KEY, GEMINI_API_KEY, VOYAGE_API_KEY, or MISTRAL_API_KEY in your         │
│    environment                                                                            │
│  - Configure credentials: openclaw configure --section model                              │
│  - For local embeddings: configure agents.defaults.memorySearch.provider and local model  │
│    path                                                                                   │
│  - To disable: openclaw config set agents.defaults.memorySearch.enabled false             │
│                                                                                           │
│  Verify: openclaw memory status --deep                                                    │
│                                                                                           │
├───────────────────────────────────────────────────────────────────────────────────────────╯
│
◇  Gateway ──────────────────────────────────────────────────────────────────────────╮
│                                                                                    │
│  Runtime: running (pid 3878156, state active, sub running, last exit 0, reason 0)  │
│                                                                                    │
├────────────────────────────────────────────────────────────────────────────────────╯
Restarted systemd service: openclaw-gateway.service
│
◇  
│
◇  Gateway ──────────────╮
│                        │
│  Gateway not running.  │
│                        │
├────────────────────────╯
│
◇  Gateway connection ────────────────────╮
│                                         │
│  Gateway target: ws://127.0.0.1:18789   │
│  Source: local loopback                 │
│  Config: /root/.openclaw/openclaw.json  │
│  Bind: lan                              │
│                                         │
├─────────────────────────────────────────╯
│
└  Doctor complete.


基于以上内容,你能看到哪里出错么? 或者需要我再提供哪些资料?

2

我删掉了auth-profiles.json多余的条目。重启 Gateway后执行openclaw models test minimax-cn,报错:

error: too many arguments for 'models'. Expected 0 arguments but got 2.

我执行下面的命令确实得到了反馈:

curl -X POST https://api.minimaxi.com/v1/chat/completions \
  -H "Authorization: Bearer sk-cp-6co...d4DdQGuYVUKzbk" \
  -H "Content-Type: application/json" \
  -d '{"model": "MiniMax-M2.5", "messages": [{"role": "user", "content": "hello"}], "max_tokens": 10}'

{"id":"05fe3f97b572ec362774357347e4a7bc","choices":[{"finish_reason":"length","index":0,"message":{"content":"\nThe user has simply said "hello".\n\n","role":"assistant","name":"MiniMax AI","audio_content":""}}],"created":1773079703,"model":"MiniMax-M2.5","object":"chat.completion","usage":{"total_tokens":52,"total_characters":0,"prompt_tokens":42,"completion_tokens":10,"completion_tokens_details":{"reasoning_tokens":10}},"input_sensitive":false,"output_sensitive":false,"input_sensitive_type":0,"output_sensitive_type":0,"output_sensitive_int":0,"base_resp":{"status_code":0,"status_msg":""}}

说明Key没有问题。


我修改openclaw.json的provider部分依然401:401 token is unusable (1004)

"minimax-cn": {
        "baseUrl": "https://api.minimaxi.com/v1",
        "apiKey": "sk-cp-6co6v8Tehx-i1KBYILM...EHBd4DdQGuYVUKzbk",
        "api": "openai-completions",
        "authHeader": true,
        "models": [
          {...

看这个怎么解决?