CLI commands
推論 CLI
openclaw infer は、プロバイダーを利用した推論のための標準的なヘッドレスインターフェースです。生の Gateway RPC 名やエージェントツール ID ではなく、機能ファミリー(model、image、audio、tts、video、web、embedding)を公開します。openclaw capability ... は同じコマンドツリーのエイリアスです。
単発のプロバイダーラッパーよりも推奨される理由は次のとおりです。
- OpenClaw ですでに設定済みのプロバイダーとモデルを再利用します。
- スクリプトやエージェント駆動の自動化に適した安定した
--jsonエンベロープを提供します(JSON 出力を参照)。 - ほとんどのサブコマンドでは、Gateway を介さず通常のローカル経路で実行します。
- エンドツーエンドのプロバイダーチェックでは、プロバイダーへのリクエストが送信される前に、リリース版の CLI、設定の読み込み、デフォルトエージェントの解決、同梱 Plugin の有効化、共有機能ランタイムを実行します。
infer を Skills にする
次の内容をコピーしてエージェントに貼り付けます。
Read https://docs.openclaw.ai/cli/infer, then create a skill that routes my common workflows to `openclaw infer`.Focus on model runs, image generation, video generation, audio transcription, TTS, web search, and embeddings.優れた infer ベースの Skills は、一般的なユーザーの意図を適切なサブコマンドに対応付け、ワークフローごとに標準的な例をいくつか含め、低レベルの代替手段より openclaw infer ... を優先し、Skills 本文で infer の全機能を改めて文書化しません。
コマンドツリー
openclaw infer list inspect model run list inspect providers auth login auth logout auth status image generate edit describe describe-many providers audio transcribe providers tts convert voices providers personas status enable disable set-provider set-persona video generate describe providers web search fetch providers embedding create providersinfer list / infer inspect --name <capability> は、このツリーをデータ(機能 ID、トランスポート、説明)として表示します。
一般的なタスク
| タスク | コマンド | 注記 |
|---|---|---|
| テキスト/モデルプロンプトを実行する | openclaw infer model run --prompt "..." --json |
デフォルトではローカル |
| 画像に対してモデルプロンプトを実行する | openclaw infer model run --prompt "Describe this" --file ./image.png --model provider/model |
複数の画像には --file を繰り返し指定 |
| 画像を生成する | openclaw infer image generate --prompt "..." --json |
既存ファイルから始める場合は image edit を使用 |
| 画像ファイルまたは URL を説明する | openclaw infer image describe --file ./image.png --prompt "..." --json |
--model は画像対応の <provider/model> であること |
| 音声を文字起こしする | openclaw infer audio transcribe --file ./memo.m4a --json |
--model は <provider/model> であること |
| 音声を合成する | openclaw infer tts convert --text "..." --output ./speech.mp3 --json |
tts status のみ Gateway 経由で実行 |
| 動画を生成する | openclaw infer video generate --prompt "..." --json |
--resolution などのプロバイダーヒントに対応 |
| 動画ファイルを説明する | openclaw infer video describe --file ./clip.mp4 --json |
--model は <provider/model> であること |
| ウェブを検索する | openclaw infer web search --query "..." --json |
|
| ウェブページを取得する | openclaw infer web fetch --url https://example.com --json |
|
| 埋め込みを作成する | openclaw infer embedding create --text "..." --json |
動作
- 出力を別のコマンドやスクリプトに渡す場合は
--jsonを使用し、それ以外ではテキスト出力を使用します。 - 特定のバックエンドに固定するには、
--providerまたは--model provider/modelを使用します。 - 1 回限りの思考/推論レベルを上書きするには、
model run --thinking <level>を使用します。指定できる値はoff、minimal、low、medium、high、adaptive、xhigh、maxです。 image describe、audio transcribe、video describeでは、--modelを<provider/model>形式で指定する必要があります。image describeの--fileにはローカルパスと HTTP(S) URL を指定できます。リモート URL には通常のメディア取得 SSRF ポリシーが適用されます。- ステートレスな実行コマンド(
model run、image *、audio *、video *、web *、embedding *)は、デフォルトでローカル実行されます。Gateway が管理する状態コマンド(tts status)は、デフォルトで Gateway 経由になります。 - ローカル経路では、Gateway が稼働している必要はありません。
- ローカルの
model runは、簡潔な 1 回限りのプロバイダー補完です。設定済みのエージェントモデルと認証を解決しますが、チャットエージェントのターンを開始せず、ツールを読み込まず、同梱 MCP サーバーも開きません。 model run --fileは画像ファイル(MIME タイプを自動検出)をプロンプトに添付します。複数の画像には--fileを繰り返し指定します。画像以外のファイルは拒否されるため、代わりにinfer audio transcribeまたはinfer video describeを使用してください。model run --gatewayは、Gateway のルーティング、保存済み認証、プロバイダー選択、組み込みランタイムを実行しますが、生のモデルプローブのままです。以前のセッショントランスクリプト、ブートストラップ/AGENTS コンテキスト、ツール、同梱 MCP サーバーは含まれません。model run --gateway --model <provider/model>は Gateway に 1 回限りのプロバイダー/モデル上書きを要求するため、信頼されたオペレーター用の Gateway 認証情報が必要です。
モデル
テキスト推論とモデル/プロバイダーの確認。
openclaw infer model run --prompt "Reply with exactly: smoke-ok" --jsonopenclaw infer model run --prompt "Summarize this changelog entry" --model openai/gpt-5.4 --jsonopenclaw infer model run --prompt "Describe this image in one sentence" --file ./photo.jpg --model google/gemini-2.5-flash --jsonopenclaw infer model run --prompt "Use more reasoning here" --thinking high --jsonopenclaw infer model providers --jsonopenclaw infer model inspect --model gpt-5.6-sol --jsonGateway を起動したりエージェントツールインターフェースを読み込んだりせずに、1 つのプロバイダーをスモークテストするには、--local と完全な <provider/model> 参照を使用します。
openclaw infer model run --local --model anthropic/claude-sonnet-4-6 --prompt "Reply with exactly: pong" --jsonopenclaw infer model run --local --model cerebras/zai-glm-4.7 --prompt "Reply with exactly: pong" --jsonopenclaw infer model run --local --model google/gemini-2.5-flash --prompt "Reply with exactly: pong" --jsonopenclaw infer model run --local --model groq/llama-3.1-8b-instant --prompt "Reply with exactly: pong" --jsonopenclaw infer model run --local --model mistral/mistral-medium-3-5 --prompt "Reply with exactly: pong" --jsonopenclaw infer model run --local --model mistral/mistral-small-latest --prompt "Reply with exactly: pong" --jsonopenclaw infer model run --local --model openai/gpt-5.6-luna --prompt "Reply with exactly: pong" --jsonopenclaw infer model run --local --model ollama/qwen2.5vl:7b --prompt "Describe this image." --file ./photo.jpg --json注記:
- ローカルの
model runは、プロバイダー/モデル/認証の正常性を確認するための最小限の CLI スモークテストです。ChatGPT-Codex 以外のプロバイダーには、指定されたプロンプトのみを送信します。 - ローカルの
model run --model <provider/model>は、そのプロバイダーが設定に書き込まれる前でも、同梱された静的カタログの完全一致行(openclaw models list --allが表示するものと同じ)を解決できます。プロバイダー認証は引き続き必要です。認証情報がない場合は、Unknown modelではなく認証エラーになります。 - Mistral Medium 3.5 の推論プローブでは、temperature を未設定/デフォルトのままにしてください。Mistral は
temperature: 0でのreasoning_effort="high"を拒否します。デフォルトの temperature または0.7などのゼロ以外の値を使用してください。 - OpenAI ChatGPT/Codex OAuth(
openai-chatgpt-responsesAPI)のローカルプローブは、トランスポートが必須のinstructionsフィールドを設定できるように、最小限のシステム指示を追加します。完全なエージェントコンテキスト、ツール、メモリ、セッショントランスクリプトは含まれません。 model run --fileは、画像コンテンツを単一のユーザーメッセージに直接添付します。一般的な形式(PNG、JPEG、WebP)は、MIME タイプがimage/*として検出される場合に使用できます。未対応または認識できないファイルは、プロバイダーを呼び出す前に失敗します。直接的なマルチモーダルモデルのプローブではなく、OpenClaw の画像モデルルーティングとフォールバックを使用したい場合は、代わりにinfer image describeを使用してください。- 選択するモデルは画像入力に対応している必要があります。テキスト専用モデルでは、プロバイダー層でリクエストが拒否される場合があります。
model run --promptには空白以外のテキストが必要です。空のプロンプトは、プロバイダーまたは Gateway を呼び出す前に拒否されます。- ローカルの
model runは、プロバイダーがテキスト出力を返さない場合にゼロ以外で終了するため、到達不能なプロバイダーや空の補完が成功したプローブとして扱われることはありません。 - モデル入力を生のまま維持しつつ Gateway のルーティングまたはエージェントランタイムの設定をテストするには、
model run --gatewayを使用します。完全なエージェントコンテキスト、ツール、メモリ、セッショントランスクリプトを使用するには、openclaw agentまたはチャットインターフェースを使用します。 --thinking adaptiveは補完ランタイムレベルのmediumに対応します。--thinking maxは、ネイティブの最大推論強度に対応する OpenAI モデルではmaxに、それ以外ではxhighに対応します。model auth login、model auth logout、model auth statusは、保存済みのプロバイダー認証状態を管理します。
画像
生成、編集、説明。
openclaw infer image generate --prompt "friendly lobster illustration" --jsonopenclaw infer image generate --prompt "cinematic product photo of headphones" --jsonopenclaw infer image generate --model openai/gpt-image-1.5 --output-format png --background transparent --prompt "simple red circle sticker on a transparent background" --jsonopenclaw infer image generate --model openai/gpt-image-2 --quality low --openai-moderation low --prompt "low-cost draft poster" --jsonopenclaw infer image generate --prompt "slow image backend" --timeout-ms 180000 --jsonopenclaw infer image edit --file ./logo.png --model openai/gpt-image-1.5 --output-format png --background transparent --prompt "keep the logo, remove the background" --jsonopenclaw infer image edit --file ./poster.png --prompt "make this a vertical story ad" --size 2160x3840 --aspect-ratio 9:16 --resolution 4K --jsonopenclaw infer image describe --file ./photo.jpg --jsonopenclaw infer image describe --file https://example.com/photo.png --jsonopenclaw infer image describe --file ./receipt.jpg --prompt "Extract the merchant, date, and total" --jsonopenclaw infer image describe-many --file ./before.png --file ./after.png --prompt "Compare the screenshots and list visible UI changes" --jsonopenclaw infer image describe --file ./ui-screenshot.png --model openai/gpt-5.4-mini --jsonopenclaw infer image describe --file ./photo.jpg --model ollama/qwen2.5vl:7b --prompt "Describe the image in one sentence" --timeout-ms 300000 --json注記:
-
既存の入力ファイルから開始する場合は
image editを使用します。--size、--aspect-ratio、--resolutionは、それらをサポートするプロバイダーやモデルにジオメトリのヒントを追加します。 -
--model openai/gpt-image-1.5とともに--output-format png --background transparentを指定すると、背景が透明な OpenAI PNG 出力が得られます。--openai-backgroundは、同じヒントに対する OpenAI 固有のエイリアスです。背景指定のサポートを宣言していないプロバイダーでは、無視されたオーバーライドとして報告されます(JSON エンベロープのignoredOverridesを参照)。 -
--quality low|medium|high|autoは、OpenAI を含む、画像品質のヒントをサポートするプロバイダーで使用できます。OpenAI では--openai-moderation low|autoも使用できます。 -
image providers --jsonは、バンドルされた画像プロバイダーのうち、検出可能、設定済み、選択済みのものと、それぞれが公開する生成/編集機能を一覧表示します。 -
image generate --model <provider/model> --jsonは、画像生成の変更に対する最小範囲のライブスモークテストです。bash openclaw infer image providers --jsonopenclaw infer image generate \ --model google/gemini-3.1-flash-image-preview \ --prompt "Minimal flat test image: one blue square on a white background, no text." \ --output ./openclaw-infer-image-smoke.png \ --jsonレスポンスには、
ok、provider、model、attempts、および書き込まれた出力パスが含まれます。--outputが設定されている場合、最終的な拡張子はプロバイダーから返された MIME タイプに従うことがあります。 -
image describeとimage describe-manyでは、タスク固有の指示(OCR、比較、UI の検査、簡潔なキャプション作成)に--promptを使用します。 -
低速なローカル視覚モデルや、コールドスタート時の Ollama には
--timeout-msを使用します。 -
image describeでは、明示的な--model(画像対応の<provider/model>である必要があります)が最初に実行され、その呼び出しが失敗した場合は、設定済みのagents.defaults.imageModel.fallbacksが試行されます。入力準備エラー(ファイルがない、URL がサポートされていない)はフォールバックの試行前に失敗し、モデルカタログまたはプロバイダー設定で画像対応モデルとして定義されている必要があります。 -
ローカルの Ollama 視覚モデルでは、最初にモデルを取得し、
OLLAMA_API_KEYに任意のプレースホルダー値(例:ollama-local)を設定します。Ollamaを参照してください。
音声
ファイルの文字起こし(リアルタイムのセッション管理ではありません)。
openclaw infer audio transcribe --file ./memo.m4a --jsonopenclaw infer audio transcribe --file ./team-sync.m4a --language en --prompt "Focus on names and action items" --jsonopenclaw infer audio transcribe --file ./memo.m4a --model openai/whisper-1 --json--model は <provider/model> である必要があります。
TTS
音声合成と TTS プロバイダー/ペルソナの状態。
openclaw infer tts convert --text "hello from openclaw" --output ./hello.mp3 --jsonopenclaw infer tts convert --text "Your build is complete" --output ./build-complete.mp3 --jsonopenclaw infer tts providers --jsonopenclaw infer tts personas --jsonopenclaw infer tts status --json注記:
tts statusは--gatewayのみをサポートします(Gateway が管理する TTS の状態を反映します)。- TTS の動作を確認および設定するには、
tts providers、tts voices、tts personas、tts set-provider、tts set-personaを使用します。
動画
生成と説明。
openclaw infer video generate --prompt "cinematic sunset over the ocean" --jsonopenclaw infer video generate --prompt "slow drone shot over a forest lake" --resolution 768P --duration 6 --jsonopenclaw infer video describe --file ./clip.mp4 --jsonopenclaw infer video describe --file ./clip.mp4 --model openai/gpt-5.4-mini --json注記:
video generateは--size、--aspect-ratio、--resolution、--duration、--audio、--watermark、--timeout-msを受け付け、動画生成ランタイムに転送します。video describeの--modelは<provider/model>である必要があります。
Web
検索と取得。
openclaw infer web search --query "OpenClaw docs" --jsonopenclaw infer web search --query "OpenClaw infer web providers" --jsonopenclaw infer web fetch --url https://docs.openclaw.ai/cli/infer --jsonopenclaw infer web providers --jsonweb providers は、検索および取得に使用可能、設定済み、選択済みのプロバイダーを一覧表示します。
埋め込み
ベクトルの作成と埋め込みプロバイダーの確認。
openclaw infer embedding create --text "friendly lobster" --jsonopenclaw infer embedding create --text "customer support ticket: delayed shipment" --model openai/text-embedding-3-large --jsonopenclaw infer embedding providers --jsonJSON 出力
Infer コマンドは、共通のエンベロープ配下に JSON 出力を正規化します。
{ "ok": true, "capability": "image.generate", "transport": "local", "provider": "openai", "model": "gpt-image-2", "attempts": [], "outputs": []}安定した最上位フィールド:
okcapabilitytransportprovidermodelattemptsinputs(該当する場合、リクエストとともに送信された画像添付ファイル)outputsignoredOverrides(該当する場合、プロバイダーがサポートしていないヒントのキー)error
生成メディアのコマンドでは、outputs に OpenClaw が書き込んだファイルが含まれます。自動化では、人間が読める標準出力を解析する代わりに、その配列内の path、mimeType、size、およびメディア固有の寸法を使用します。
よくある落とし穴
# Badopenclaw infer media image generate --prompt "friendly lobster" # Goodopenclaw infer image generate --prompt "friendly lobster"# Badopenclaw infer audio transcribe --file ./memo.m4a --model whisper-1 --json # Goodopenclaw infer audio transcribe --file ./memo.m4a --model openai/whisper-1 --json