📖 使用指南 中等 约 4 分钟阅读

OpenClaw Security & Cost

了解 OpenClaw 的安全架构,历史安全事件,以及如何有效控制 API 调用成本。

V
Victor.Chen
2026年3月19日

Source: OpenClaw Orange Paper v1.2.0, Chapters 28-30

Security Model

Three-Layer Security Architecture

Application security → user authentication, permission control, operation auditing
Data security → local storage, encrypted transmission, access control
Execution security → sandbox isolation, resource limits, operation verification

On-Premises Security

Advantages:

  • All data is stored on your own servers
  • API Keys never pass through a third party
  • Fully under your own control

Configuration tips:

security:
  admin_password: "a-strong-password"
  https: true
  firewall: true
  access_log: true

Cloud Deployment Security

Checklist:

  • Configure firewall rules
  • Use HTTPS
  • Set an access password
  • Keep the system updated

Known Security Incidents

Historical Issues

Time Issue Impact Fix
2024-03 API Key leak Account compromise Store keys in environment variables
2024-06 Malicious skill Dangerous commands executed Skill review mechanism
2024-09 DDoS attack Service unavailable Rate-limit protection

Protective Measures

  1. API Key rotation: change keys regularly
  2. Access restriction: IP allowlist
  3. Operation auditing: log every action
  4. Skill review: only install skills you trust

Cost Control

Cost Breakdown

Total cost = server cost + model API cost + storage cost
Cost item Range Notes
Server ¥0-200/mo Free on-premises; paid for cloud servers
Model API calls ¥0-500/mo Depends on usage frequency
Storage ¥0-50/mo Free locally; paid for cloud storage

Model API Cost Comparison

Model Input price Output price Best for
Claude 3.5 Sonnet $3/1M $15/1M Daily use
GPT-4o $2.5/1M $10/1M Daily use
DeepSeek V3 ¥1/1M ¥2/1M Cost-sensitive
Gemini Pro Free Free Tight budgets
Ollama (local) Free Free Privacy-first

Cost Optimization Strategies

1. Model Tiering

Route tasks of different complexity to different models:

tasks:
  simple: gemini-free      # simple Q&A
  medium: deepseek-chat     # everyday chat
  complex: claude-sonnet    # complex reasoning

2. Caching

  • Enable response caching
  • Set cache expiration
  • Reuse answers to common questions

3. Batching

  • Merge similar requests
  • Use batch APIs
  • Reduce the number of calls

4. Usage Monitoring

# View usage statistics
openclaw stats

# Set a usage alert
openclaw alert --monthly 50

Monthly Cost Estimates

Usage Recommended setup Estimated cost
Light (a few times a week) Gemini free tier ¥0-20/mo
Medium (daily use) DeepSeek ¥30-80/mo
Heavy (frequent use) Claude/GPT ¥100-300/mo
Enterprise Multi-model + cloud server ¥200-500/mo

Cost Monitoring

Setting Budget Alerts

budget:
  daily: 10      # daily budget ¥10
  monthly: 200    # monthly budget ¥200
  alert: true     # alert on overage

Usage Reports

Review usage reports regularly:

  • Stats by model
  • Stats by time period
  • Stats by task type

Want this set up for you?

Tell us the first job you want automated - join the 14-day setup experiment.

This 14-day experiment

Email is only used to send the pack and a checkout link. No resale. No charge happens on this page.