Providers
ds4
ds4 ให้บริการ DeepSeek V4 Flash จากแบ็กเอนด์
Metal ภายในเครื่องผ่าน API /v1 ที่เข้ากันได้กับ OpenAI โดย OpenClaw เชื่อมต่อกับ ds4
ผ่านกลุ่มผู้ให้บริการทั่วไป openai-completions
ds4 ไม่ใช่ Plugin ผู้ให้บริการที่มาพร้อมกับ OpenClaw ให้กำหนดค่าภายใต้
models.providers.ds4 แล้วเลือก ds4/deepseek-v4-flash
| คุณสมบัติ | ค่า |
|---|---|
| รหัสผู้ให้บริการ | ds4 |
| Plugin | ไม่มี (ใช้การกำหนดค่าเท่านั้น) |
| API | Chat Completions ที่เข้ากันได้กับ OpenAI (openai-completions) |
| URL ฐาน | http://127.0.0.1:18000/v1 (แนะนำ) |
| รหัสโมเดล | deepseek-v4-flash |
| การเรียกใช้เครื่องมือ | tools / tool_calls รูปแบบ OpenAI |
| การใช้เหตุผล | thinking และ reasoning_effort รูปแบบ DeepSeek |
ข้อกำหนด
- macOS ที่รองรับ Metal
- สำเนาโค้ด ds4 ที่ใช้งานได้ พร้อม
ds4-serverและไฟล์ GGUF ของ DeepSeek V4 Flash - หน่วยความจำเพียงพอสำหรับบริบทที่คุณเลือก โดยค่า
--ctxที่มากขึ้นจะจัดสรร หน่วยความจำ KV เพิ่มขึ้นเมื่อเริ่มต้นเซิร์ฟเวอร์
เริ่มต้นอย่างรวดเร็ว
เริ่มต้น ds4-server
แทนที่ <DS4_DIR> ด้วยพาธของสำเนาโค้ด ds4 ของคุณ
<DS4_DIR>/ds4-server \ --model <DS4_DIR>/ds4flash.gguf \ --host 127.0.0.1 \ --port 18000 \ --ctx 32768 \ --tokens 128ตรวจสอบเอ็นด์พอยต์ที่เข้ากันได้กับ OpenAI
curl http://127.0.0.1:18000/v1/modelsการตอบกลับควรมี deepseek-v4-flash
เพิ่มการกำหนดค่าผู้ให้บริการ OpenClaw
เพิ่มการกำหนดค่าจาก การกำหนดค่าแบบเต็ม แล้วเรียกใช้การตรวจสอบโมเดล แบบครั้งเดียว:
openclaw 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
{ 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 และกำหนด maxTokens ให้สอดคล้อง
กับ --tokens เว้นแต่คุณตั้งใจให้ OpenClaw ร้องขอเอาต์พุตน้อยกว่าค่าเริ่มต้น
ของเซิร์ฟเวอร์
การเริ่มต้นตามต้องการ
OpenClaw สามารถเริ่มต้น ds4 เฉพาะเมื่อมีการเลือกโมเดล ds4/... เพิ่ม
localService ลงในรายการผู้ให้บริการเดียวกัน:
{ 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)
หากคุณใช้บริบทขนาดใหญ่นั้น ให้อัปเดตทั้งแฟล็กของเซิร์ฟเวอร์และข้อมูลเมตาของโมเดล OpenClaw:
{ contextWindow: 393216, maxTokens: 384000, compat: { supportsUsageInStreaming: true, supportsReasoningEffort: true, maxTokensField: "max_tokens", supportsStrictMode: false, thinkingFormat: "deepseek", supportedReasoningEfforts: ["low", "medium", "high", "xhigh", "max"], },}การทดสอบ
ตรวจสอบ HTTP โดยตรงโดยข้าม OpenClaw:
curl 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 (เหมือนกับการตรวจสอบในส่วนเริ่มต้นอย่างรวดเร็ว):
openclaw infer model run \ --local \ --model ds4/deepseek-v4-flash \ --thinking off \ --prompt "Reply with exactly: openclaw-ds4-ok" \ --jsonการทดสอบเบื้องต้นของเอเจนต์เต็มรูปแบบและการเรียกใช้เครื่องมือ โดยมีบริบทอย่างน้อย 32768:
openclaw 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คือds4executionTrace.winnerModelคือdeepseek-v4-flashtoolSummary.callsมีค่าอย่างน้อย1finalAssistantVisibleTextขึ้นต้นด้วยtool-ok
การแก้ไขปัญหา
curl /v1/models ไม่สามารถเชื่อมต่อได้
ds4 ไม่ได้ทำงานอยู่หรือไม่ได้ผูกกับโฮสต์/พอร์ตใน baseUrl ให้เริ่มต้น
ds4-server แล้วลองอีกครั้ง:
curl http://127.0.0.1:18000/v1/models500 prompt exceeds context
ค่า --ctx ที่กำหนดไว้มีขนาดเล็กเกินไปสำหรับรอบการทำงานของ OpenClaw ให้เพิ่มค่า
ds4-server --ctx แล้วอัปเดต models.providers.ds4.models[].contextWindow
ให้ตรงกัน รอบการทำงานของเอเจนต์เต็มรูปแบบที่ใช้เครื่องมือต้องการบริบทมากกว่า
คำขอ curl แบบข้อความเดียวโดยตรงอย่างมาก
Think Max ไม่เปิดใช้งาน
ds4 ใช้ Think Max เฉพาะเมื่อ --ctx มีค่าอย่างน้อย 393216 และคำขอ
ร้องขอ reasoning_effort: "max" บริบทที่เล็กกว่าจะย้อนกลับไปใช้
การใช้เหตุผลระดับสูง
คำขอแรกทำงานช้า
ds4 มีช่วงนำโมเดลเข้าสู่ Metal แบบเริ่มต้นจากสถานะเย็นและช่วงอุ่นเครื่องโมเดล ให้ตั้งค่า
localService.readyTimeoutMs: 300000 เมื่อ OpenClaw เริ่มต้นเซิร์ฟเวอร์
ตามต้องการ
เนื้อหาที่เกี่ยวข้อง
เริ่มต้นเซิร์ฟเวอร์โมเดลภายในเครื่องตามต้องการก่อนส่งคำขอไปยังโมเดล
เลือกและใช้งานแบ็กเอนด์โมเดลภายในเครื่อง
กำหนดค่าการอ้างอิงผู้ให้บริการ การยืนยันตัวตน และการสลับไปใช้ระบบสำรอง
ลักษณะการทำงานของผู้ให้บริการ DeepSeek แบบเนทีฟและการควบคุมการคิด