ModelsProviders
ds4 は、ローカルの
Metal バックエンドから、OpenAI 互換の /v1 API を使用して DeepSeek V4 Flash を提供します。OpenClaw は汎用の openai-completions プロバイダーファミリーを通じて ds4 に接続します。
ds4 は OpenClaw に同梱されるプロバイダー Plugin ではありません。
models.providers.ds4 で設定してから、ds4/deepseek-v4-flash を選択します。
| プロパティー |
値 |
| プロバイダー ID |
ds4 |
| Plugin |
なし(設定のみ) |
| API |
OpenAI 互換 Chat Completions(openai-completions) |
| ベース URL |
http://127.0.0.1:18000/v1(推奨) |
| モデル ID |
deepseek-v4-flash |
| ツール呼び出し |
OpenAI 形式の tools / tool_calls |
| 推論 |
DeepSeek 形式の thinking および reasoning_effort |
要件
- Metal をサポートする macOS。
ds4-server と DeepSeek V4 Flash GGUF ファイルを含む、動作する ds4 チェックアウト。
- 選択するコンテキストに十分なメモリ。
--ctx の値を大きくすると、サーバー起動時に割り当てられる
KV メモリが増加します。
クイックスタート
ds4-server を起動する
<DS4_DIR> を ds4 チェックアウトのパスに置き換えます。
bash<DS4_DIR>/ds4-server \ --model <DS4_DIR>/ds4flash.gguf \ --host 127.0.0.1 \ --port 18000 \ --ctx 32768 \ --tokens 128
OpenAI 互換エンドポイントを確認する
bashcurl http://127.0.0.1:18000/v1/models
レスポンスに deepseek-v4-flash が含まれている必要があります。
OpenClaw プロバイダー設定を追加する
完全な設定の設定を追加してから、1 回限りのモデルチェックを
実行します。
bashopenclaw infer model run \ --local \ --model ds4/deepseek-v4-flash \ --thinking off \ --prompt "Reply with exactly: openclaw-ds4-ok" \ --json
完全な設定
ds4 がすでに 127.0.0.1:18000 で実行されている場合は、この設定を使用します。
json5{ agents: { defaults: { model: { primary: "ds4/deepseek-v4-flash" }, models: { "ds4/deepseek-v4-flash": { alias: "DS4 local", }, }, }, }, models: { mode: "merge", providers: { ds4: { baseUrl: "http://127.0.0.1:18000/v1", apiKey: "ds4-local", api: "openai-completions", timeoutSeconds: 300, models: [ { id: "deepseek-v4-flash", name: "DeepSeek V4 Flash (ds4)", reasoning: true, input: ["text"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 32768, maxTokens: 128, compat: { supportsUsageInStreaming: true, supportsReasoningEffort: true, maxTokensField: "max_tokens", supportsStrictMode: false, thinkingFormat: "deepseek", supportedReasoningEfforts: ["low", "medium", "high", "xhigh"], }, }, ], }, }, },}
contextWindow を ds4-server --ctx と一致させてください。OpenClaw がサーバーのデフォルトよりも少ない出力を要求するよう意図している場合を除き、maxTokens を
--tokens と一致させてください。
オンデマンド起動
OpenClaw は、ds4/... モデルが選択された場合にのみ ds4 を起動できます。同じプロバイダーエントリに
localService を追加します。
json5{ models: { providers: { ds4: { baseUrl: "http://127.0.0.1:18000/v1", apiKey: "ds4-local", api: "openai-completions", timeoutSeconds: 300, localService: { command: "<DS4_DIR>/ds4-server", args: [ "--model", "<DS4_DIR>/ds4flash.gguf", "--host", "127.0.0.1", "--port", "18000", "--ctx", "32768", "--tokens", "128", ], cwd: "<DS4_DIR>", healthUrl: "http://127.0.0.1:18000/v1/models", readyTimeoutMs: 300000, idleStopMs: 0, }, models: [ { id: "deepseek-v4-flash", name: "DeepSeek V4 Flash (ds4)", reasoning: true, input: ["text"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 32768, maxTokens: 128, compat: { supportsUsageInStreaming: true, supportsReasoningEffort: true, maxTokensField: "max_tokens", supportsStrictMode: false, thinkingFormat: "deepseek", supportedReasoningEfforts: ["low", "medium", "high", "xhigh"], }, }, ], }, }, },}
command は実行可能ファイルの絶対パスである必要があります。シェル検索と ~ 展開は
使用されません。すべての localService フィールドについては、ローカルモデルサービスを参照してください。
Think Max
ds4 は、次の両方が真の場合にのみ Think Max を適用します。
ds4-server が --ctx 393216 以上で開始されている。
- リクエストが
reasoning_effort: "max"(または同等の ds4 effort フィールド)を使用している。
この大きなコンテキストを実行する場合は、サーバーフラグと OpenClaw のモデル
メタデータの両方を更新します。
json5{ contextWindow: 393216, maxTokens: 384000, compat: { supportsUsageInStreaming: true, supportsReasoningEffort: true, maxTokensField: "max_tokens", supportsStrictMode: false, thinkingFormat: "deepseek", supportedReasoningEfforts: ["low", "medium", "high", "xhigh", "max"], },}
テスト
OpenClaw を経由しない直接 HTTP チェック:
bashcurl http://127.0.0.1:18000/v1/chat/completions \ -H 'content-type: application/json' \ -d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"Reply with exactly: ds4-ok"}],"max_tokens":16,"stream":false,"thinking":{"type":"disabled"}}'
OpenClaw モデルルーティング(クイックスタートのチェックと同じ):
bashopenclaw infer model run \ --local \ --model ds4/deepseek-v4-flash \ --thinking off \ --prompt "Reply with exactly: openclaw-ds4-ok" \ --json
少なくとも 32768 のコンテキストを使用した、完全なエージェントとツール呼び出しのスモークテスト:
bashopenclaw agent \ --local \ --session-id ds4-tool-smoke \ --model ds4/deepseek-v4-flash \ --thinking off \ --message "Use the shell command pwd once, then reply exactly: tool-ok <output>" \ --json \ --timeout 240
期待される結果:
executionTrace.winnerProvider が ds4
executionTrace.winnerModel が deepseek-v4-flash
toolSummary.calls が少なくとも 1
finalAssistantVisibleText が tool-ok で始まる
トラブルシューティング
curl /v1/models に接続できない
ds4 が実行されていないか、baseUrl のホスト/ポートにバインドされていません。
ds4-server を起動してから、再試行します。
bashcurl http://127.0.0.1:18000/v1/models
500 prompt exceeds context
設定された --ctx は、OpenClaw のターンには小さすぎます。
ds4-server --ctx を増やしてから、それに合わせて models.providers.ds4.models[].contextWindow
を更新します。ツールを含む完全なエージェントターンには、1 メッセージだけの直接 curl リクエストよりも
はるかに多くのコンテキストが必要です。
Think Max が有効にならない
ds4 が Think Max を使用するのは、--ctx が少なくとも 393216 であり、リクエストが
reasoning_effort: "max" を要求する場合のみです。より小さなコンテキストでは、高い
推論レベルにフォールバックします。
最初のリクエストが遅い
ds4 には、Metal への初回常駐処理とモデルのウォームアップフェーズがあります。OpenClaw がサーバーを
オンデマンドで起動する場合は、localService.readyTimeoutMs: 300000 を設定します。
関連項目