Anthropic - OpenClaw

2 min read Original article ↗

Documentation Index

Fetch the complete documentation index at: https://docs.openclaw.ai/llms.txt

Use this file to discover all available pages before exploring further.

Anthropic builds the Claude model family. OpenClaw supports two auth routes:

  • API key — direct Anthropic API access with usage-based billing (anthropic/* models)
  • Claude CLI — reuse an existing Claude CLI login on the same host

Getting started

Best for: standard API access and usage-based billing.

Config example

{
  env: { ANTHROPIC_API_KEY: "sk-ant-..." },
  agents: { defaults: { model: { primary: "anthropic/claude-opus-4-6" } } },
}

Best for: reusing an existing Claude CLI login without a separate API key.

Config example

Prefer the canonical Anthropic model ref plus a CLI runtime override:

{
  agents: {
    defaults: {
      model: { primary: "anthropic/claude-opus-4-7" },
      models: {
        "anthropic/claude-opus-4-7": {
          agentRuntime: { id: "claude-cli" },
        },
      },
    },
  },
}

Legacy claude-cli/claude-opus-4-7 model refs still work for compatibility, but new config should keep provider/model selection as anthropic/* and put the execution backend in provider/model runtime policy.

Thinking defaults (Claude 4.6)

Claude 4.6 models default to adaptive thinking in OpenClaw when no explicit thinking level is set. Override per-message with /think:<level> or in model params:

{
  agents: {
    defaults: {
      models: {
        "anthropic/claude-opus-4-6": {
          params: { thinking: "adaptive" },
        },
      },
    },
  },
}

Prompt caching

OpenClaw supports Anthropic’s prompt caching feature for API-key auth.

ValueCache durationDescription
"short" (default)5 minutesApplied automatically for API-key auth
"long"1 hourExtended cache
"none"No cachingDisable prompt caching
{
  agents: {
    defaults: {
      models: {
        "anthropic/claude-opus-4-6": {
          params: { cacheRetention: "long" },
        },
      },
    },
  },
}

Advanced configuration

Troubleshooting