OPENCLAW + CLAUDE

OpenClaw で Claude を使う。

Anthropic Claude は、最大の能力(200K コンテキスト、拡張思考)のための Opus 4.8、バランスの取れたパフォーマンスのための Sonnet 4.6、スピードのための Haiku 4.5 を提供します。OpenClaw は RunAPI の OpenAI 互換エンドポイント経由で Anthropic 公式のトークン単価の 50% で Claude を呼び出します——同じモデル、同じ出力、半分のコスト。

1つの APIキー · OpenAI 互換エンドポイント · トークン単価 50% オフの課金
RunAPI を使って OpenClaw から Claude のチャット補完リクエストを送信します。

要件:
- RunAPI のチャット補完エンドポイント https://runapi.ai/v1/chat/completions を呼び出します
- model を "claude-opus-4.8" に設定します
- 認証には RUNAPI_API_KEY 環境変数を使用します
- レスポンスは同期的です——assistant メッセージはレスポンスボディで直接返されます
- ストリーミングには "stream": true を設定して server-sent events を受け取ります
curl -X POST https://runapi.ai/v1/chat/completions \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-4.8",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Explain the difference between a mutex and a semaphore in three sentences."}
    ]
  }'
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "model": "claude-opus-4.8",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "A mutex is a locking mechanism that allows only one thread to access a resource at a time..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 87,
    "total_tokens": 111
  }
}
curlコマンドをコピーしてテスト claude
仕組み

OpenClaw で Claude を使う3ステップ

1

Configure RunAPI

Set the RUNAPI_API_KEY environment variable. If you already configured RunAPI as an OpenClaw provider, the same key works for Claude — no extra setup needed. OpenClaw uses the openai-completions API mode pointed at https://runapi.ai/v1.

export RUNAPI_API_KEY=runapi_xxx
2

Call Claude

Send a POST request to /v1/chat/completions with model set to claude-opus-4.8. Include a messages array with at least one user message. Set max_tokens to control response length. Add "stream" true if you want token-by-token SSE output.

POST /v1/chat/completions
3

Read the response

The endpoint returns the assistant message synchronously — no task polling needed. The response includes token usage counts for billing transparency. Streaming responses arrive as SSE events, each containing a delta chunk.

usage.total_tokens: 111
パラメータ

Claude API パラメータ(OpenAI 互換)

パラメータ 説明
model string Required. claude-opus-4.8, claude-sonnet-4.6, claude-haiku-4.5, or any Claude variant listed in the RunAPI catalog.
messages array Required. Array of message objects with role (system, user, assistant) and content fields.
max_tokens integer Maximum number of tokens in the response. Defaults vary by model — set explicitly for predictable billing.
stream boolean When true, returns server-sent events with incremental token deltas instead of a single JSON response.
temperature float Sampling temperature between 0 and 1. Lower values produce more deterministic output.
top_p float Nucleus sampling cutoff. Alternative to temperature — use one or the other, not both.

OpenClaw上のClaudeとは?

ClaudeはAnthropicのLLMファミリーです——Opus 4.8は200Kコンテキストと拡張思考による深い分析・Sonnet 4.6は日常的なコーディングと執筆・Haiku 4.5は高速低コストタスク向けです。RunAPIを通じてOpenClaw agentは公式Anthropicの1トークンあたり価格の50%でClaudeを呼び出し、繰り返しコンテキストのシーンでコストをさらに削減するプロンプトキャッシングをサポートします。

Claudeの活用例

ツール使用によるAgentic Coding

Claudeの関数呼び出しとMCP(Model Context Protocol)を使って自動化されたコーディングワークフローを構築します——コード生成・PRレビュー・マルチファイルリファクタリング・テスト作成をツール補助のコンテキスト収集で行います。

200Kコンテキストによる長文書分析

コードベース全体・法的契約・研究論文をClaude Opus 4.8の200Kトークンコンテキストウィンドウに入力して分析・要約・Q&Aを行い、チャンキング不要です。

監査証跡付きエンタープライズ自動化

Claudeがドキュメントを処理・データを抽出・意思決定する自動化ワークフローを構築し、コスト透明性と請求監査のためにトークン使用量を追跡します。

FAQ

Claude + OpenClaw のよくある質問

OpenClaw の基本設定

まだ設定していませんか?OpenClaw の RunAPI セットアップガイドから始めましょう。

OpenClaw セットアップガイド →

Claude モデルカタログ

すべての Claude バリアント、トークン単価、コンテキストウィンドウの詳細を確認できます。

Claude モデル →

今すぐ OpenClaw で Claude を試す。

無料の RunAPI キーを取得し、プロンプトを OpenClaw に貼り付けて、Anthropic 公式料金の 50% で Claude を使い始めましょう。