Skip to content

OpenClaw 配置模板(一键复制)

本页提供一元模型接入 OpenClaw 所需的 3 个配置文件的完整模板,可直接复制粘贴使用。

使用前请将所有 sk-你的Key 替换为你在 一元模型控制台 获取的真实 API Key。


文件 1:~/.openclaw/openclaw.json

这是 OpenClaw 的主配置文件。如果你已有其他提供商,只需将 timesniper 相关内容合并进去即可。

json
{
  "models": {
    "mode": "merge",
    "providers": {
      "timesniper": {
        "baseUrl": "https://timesniper.club",
        "apiKey": "sk-你的Key",
        "api": "anthropic-messages",
        "models": [
          {
            "id": "claude-sonnet-4-6",
            "name": "Claude 4.6 Sonnet",
            "reasoning": false,
            "input": ["text", "image"],
            "contextWindow": 200000,
            "maxTokens": 8192
          },
          {
            "id": "claude-sonnet-4-6-thinking",
            "name": "Claude 4.6 Sonnet TK",
            "reasoning": true,
            "input": ["text", "image"],
            "contextWindow": 200000,
            "maxTokens": 8192
          },
          {
            "id": "claude-opus-4-6",
            "name": "Claude 4.6 Opus",
            "reasoning": false,
            "input": ["text", "image"],
            "contextWindow": 200000,
            "maxTokens": 8192
          },
          {
            "id": "claude-opus-4-6-thinking",
            "name": "Claude 4.6 Opus TK",
            "reasoning": true,
            "input": ["text", "image"],
            "contextWindow": 200000,
            "maxTokens": 8192
          }
        ]
      }
    }
  },
  "auth": {
    "profiles": {
      "timesniper:default": {
        "provider": "timesniper",
        "mode": "api_key"
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "timesniper/claude-sonnet-4-6",
        "fallbacks": [
          "timesniper/claude-opus-4-6"
        ]
      },
      "models": {
        "timesniper/claude-sonnet-4-6": { "alias": "claude-sonnet-4-6" },
        "timesniper/claude-sonnet-4-6-thinking": { "alias": "claude-sonnet-4-6-thinking" },
        "timesniper/claude-opus-4-6": { "alias": "claude-opus-4-6" },
        "timesniper/claude-opus-4-6-thinking": { "alias": "claude-opus-4-6-thinking" }
      },
      "compaction": { "mode": "safeguard" },
      "maxConcurrent": 4,
      "subagents": { "maxConcurrent": 8 }
    },
    "list": [
      { "id": "main" }
    ]
  },
  "tools": {
    "exec": { "security": "full" }
  }
}

文件 2:~/.openclaw/agents/main/agent/models.json

Agent 级模型定义文件,比主配置多了 cost 和每个模型独立的 api 字段。

json
{
  "providers": {
    "timesniper": {
      "baseUrl": "https://timesniper.club",
      "apiKey": "sk-你的Key",
      "api": "anthropic-messages",
      "models": [
        {
          "id": "claude-sonnet-4-6",
          "name": "Claude 4.6 Sonnet",
          "reasoning": false,
          "input": ["text", "image"],
          "contextWindow": 200000,
          "maxTokens": 8192,
          "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
          "api": "anthropic-messages"
        },
        {
          "id": "claude-sonnet-4-6-thinking",
          "name": "Claude 4.6 Sonnet TK",
          "reasoning": true,
          "input": ["text", "image"],
          "contextWindow": 200000,
          "maxTokens": 8192,
          "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
          "api": "anthropic-messages"
        },
        {
          "id": "claude-opus-4-6",
          "name": "Claude 4.6 Opus",
          "reasoning": false,
          "input": ["text", "image"],
          "contextWindow": 200000,
          "maxTokens": 8192,
          "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
          "api": "anthropic-messages"
        },
        {
          "id": "claude-opus-4-6-thinking",
          "name": "Claude 4.6 Opus TK",
          "reasoning": true,
          "input": ["text", "image"],
          "contextWindow": 200000,
          "maxTokens": 8192,
          "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
          "api": "anthropic-messages"
        }
      ]
    }
  }
}

文件 3:~/.openclaw/agents/main/agent/auth-profiles.json

认证密钥存储文件。

json
{
  "version": 1,
  "profiles": {
    "timesniper:default": {
      "provider": "timesniper",
      "type": "api_key",
      "key": "sk-你的Key"
    }
  },
  "lastGood": {
    "timesniper": "timesniper:default"
  }
}

参数速查表

参数说明
baseUrlhttps://timesniper.club不带 /v1
apianthropic-messagesAnthropic 原生 messages 端点
reasoning: false普通模式标准响应
reasoning: truethinking 模式深度推理,输出思考过程
contextWindow200000最大上下文窗口
maxTokens8192最大输出 Token
cost0中转站自行计费,无需本地统计