freshcrate
Home > AI Agents > openclaw-model-bridge

openclaw-model-bridge

Connect any LLM to OpenClaw โ€” production-tested middleware for Qwen3-235B and beyond

Description

Connect any LLM to OpenClaw โ€” production-tested middleware for Qwen3-235B and beyond

README

openclaw-model-bridge

Agent Runtime Control Plane โ€” Connect any LLM to OpenClaw with one command. Zero dependencies, 7 providers, multimodal support. ๅฐ†ไปปๆ„ๅคงๆจกๅž‹๏ผˆQwen / OpenAI / Gemini / Claude / Kimi / MiniMax / GLM๏ผ‰ไธ€้”ฎๆŽฅๅ…ฅ OpenClaw โ€” ้›ถ็ฌฌไธ‰ๆ–นไพ่ต–ใ€ๆ”ฏๆŒๅคšๆจกๆ€ใ€10 ๅˆ†้’Ÿ่ท‘้€šใ€‚

License: MIT Python 3.8+ Tests Providers SLO Jobs CI Notifications

Architecture / ็ณป็ปŸๆžถๆž„

Architecture Diagram

Text version / ๆ–‡ๆœฌ็‰ˆๆœฌ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                 ็”จๆˆทๅฑ‚ (WhatsApp + Discord ๅŒ้€š้“)                โ”‚
โ”‚             ๆ–‡ๆœฌ / ๅ›พ็‰‡ / ่ฏญ้Ÿณๆถˆๆฏ | 6ไธชDiscord้ข‘้“               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  โ‘  ๆ ธๅฟƒๆ•ฐๆฎ้€š่ทฏ๏ผˆๅฎžๆ—ถๅฏน่ฏ + ๅคšๆจกๆ€ + SLO ็›‘ๆŽง๏ผ‰                   โ”‚
โ”‚                                                                  โ”‚
โ”‚  WhatsApp โ†โ”                                                     โ”‚
โ”‚  Discord  โ†โ”ผโ†’ Gateway (:18789) โ†โ†’ Proxy (:5002) โ†โ†’ Adapter (:5001) โ†โ†’ LLM (7 Providers) โ”‚
โ”‚            โ”‚  [launchd]           [็ญ–็•ฅ่ฟ‡ๆปค+็›‘ๆŽง]    [่ฎค่ฏ+Fallback]    [Qwen3-235B]       โ”‚
โ”‚            โ”‚  [ๅช’ไฝ“ๅญ˜ๅ‚จ]          [ๅ›พ็‰‡base64ๆณจๅ…ฅ]   [VLๆจกๅž‹่ทฏ็”ฑ]       [+6 more providers] โ”‚
โ”‚  notify.sh โ”˜  [ๅŒ้€š้“ๆŽจ้€]        [่‡ชๅฎšไน‰ๅทฅๅ…ทๆณจๅ…ฅ]    [โ†’Gemini้™็บง]                        โ”‚
โ”‚                                   data_clean(ๆธ…ๆด—)                                       โ”‚
โ”‚                                   search_kb(ๆททๅˆๆฃ€็ดข)                                    โ”‚
โ”‚                                   [SLOๆŒ‡ๆ ‡้‡‡้›†]                                          โ”‚
โ”‚                                   ๅปถ่ฟŸp95/้”™่ฏฏๅˆ†็ฑป                                       โ”‚
โ”‚                                   ๅทฅๅ…ทๆˆๅŠŸ็އ/้™็บง็އ                                      โ”‚
โ”‚                                                                  โ”‚
โ”‚  search_kbๆต็จ‹๏ผš็”จๆˆท้—ฎ่ฎบๆ–‡ โ†’ PA่ฐƒsearch_kb โ†’ Proxyๆ‹ฆๆˆช           โ”‚
โ”‚    โ†’ โ‘ ่ฏญไน‰ๆœ็ดข(embedding cosine) + โ‘กๅ…ณ้”ฎ่ฏ่กฅๅ……                   โ”‚
โ”‚    โ†’ ๆ”ฏๆŒsource่ฟ‡ๆปค(arxiv/hf/hn็ญ‰) + ๆ—ถ้—ด่ฟ‡ๆปค(recent_hours)      โ”‚
โ”‚    โ†’ ็ป“ๆžœๆณจๅ…ฅๅฏน่ฏ โ†’ followup LLM่ฐƒ็”จ โ†’ ่‡ช็„ถ่ฏญ่จ€ๅ›ž็ญ”              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚                  โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  โ‘ก ็Ÿฅ่ฏ†ๅบ“ + ๆœฌๅœฐ AI๏ผˆ้›ถ API ่ฐƒ็”จ๏ผ‰                                โ”‚
โ”‚                                                                  โ”‚
โ”‚  KB Notes + Sources โ”€โ”€โ†’ kb_embed.py โ”€โ”€โ†’ ๆœฌๅœฐ Embedding (384็ปด)   โ”‚
โ”‚                          (sentence-transformers, ๆฏ4hๅขž้‡)        โ”‚
โ”‚                                โ†“                                 โ”‚
โ”‚                         ~/.kb/text_index/ โ”€โ”€โ†’ kb_rag.py (RAG)    โ”‚
โ”‚                                                                  โ”‚
โ”‚  ๅช’ไฝ“ๆ–‡ไปถ โ”€โ”€โ†’ mm_index.py โ”€โ”€โ†’ Gemini Embedding 2 (768็ปด)         โ”‚
โ”‚                     โ†“                                            โ”‚
โ”‚              ~/.kb/mm_index/ โ”€โ”€โ†’ mm_search.py (่ฏญไน‰ๆœ็ดข)          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  โ‘ข ๅฎšๆ—ถไปปๅŠกๅฑ‚๏ผˆ32 ไธช system cron jobs๏ผŒ28 active๏ผ‰                โ”‚
โ”‚                                                                  โ”‚
โ”‚  ่ฎบๆ–‡็›‘ๆŽง็Ÿฉ้˜ต๏ผˆ5ๆบ๏ผ‰๏ผš                                            โ”‚
โ”‚    ArXiv(ๆฏ3h) + HF Papers(10:00) + S2(11:00)                   โ”‚
โ”‚    + DBLP(12:00) + ACL(09:30) โ”€โ”€โ†’ KB + WhatsApp + DiscordๆŽจ้€   โ”‚
โ”‚  ๆฏ3h   HN็ƒญๅธ–ๆŠ“ๅ– โ”€โ”€โ†’ KB + WhatsApp + DiscordๆŽจ้€               โ”‚
โ”‚  ๆฏๅคฉร—3 ่ดงไปฃWatcher โ”€โ”€โ†’ LLMๅˆ†ๆž + KB + WhatsApp + DiscordๆŽจ้€    โ”‚
โ”‚  ๆฏๅคฉ   OpenClaw Releases โ”€โ”€โ†’ LLMๆ‘˜่ฆ + KB + WhatsApp + Discord  โ”‚
โ”‚  ๆฏๅฐๆ—ถ Issues็›‘ๆŽง โ”€โ”€โ†’ KB + WhatsApp + DiscordๆŽจ้€               โ”‚
โ”‚  ๆฏๅคฉ   KBๆฏๆ—ฅๆ‘˜่ฆ / ๆ™š้—ดๆ•ด็† / ๆ™บ่ƒฝๅŽป้‡                          โ”‚
โ”‚  ๆฏ4h   KB ๅ‘้‡็ดขๅผ•๏ผˆๆœฌๅœฐ embedding๏ผ‰                             โ”‚
โ”‚  ๆฏ2h   ๅคšๅช’ไฝ“็ดขๅผ•๏ผˆGemini Embedding 2๏ผ‰                          โ”‚
โ”‚  ๆฏๅคฉ   ๅฏน่ฏ่ดจ้‡ๆ—ฅๆŠฅ / Token็”จ้‡ๆ—ฅๆŠฅ                              โ”‚
โ”‚  ๆฏๅ‘จ   KBๆทฑๅบฆๅ›ž้กพ / ๅฅๅบทๅ‘จๆŠฅ / AI่ถ‹ๅŠฟๆŠฅๅ‘Š                        โ”‚
โ”‚  ๆฏๅคฉ   Gateway state ๅค‡ไปฝ๏ผˆๅค–ๆŒ‚ SSD๏ผ‰                            โ”‚
โ”‚  ๆฏ30m  WhatsApp ไฟๆดป                                            โ”‚
โ”‚  ๆฏ4h   Job Watchdog๏ผˆๅ…ƒ็›‘ๆŽงๅ‘Š่ญฆ๏ผ‰                                โ”‚
โ”‚  ๆฏ2m   auto_deploy๏ผˆGitโ†’่ฟ่กŒๆ—ถ่‡ชๅŠจๅŒๆญฅ๏ผ‰                         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  โ‘ฃ ๆŽงๅˆถๅนณ้ข๏ผˆSLO + ้˜ˆๅ€ผไธญๅฟƒๅŒ– + ๆ•…้šœๅฟซ็…ง + 19้กนไฝ“ๆฃ€ + CI๏ผ‰        โ”‚
โ”‚                                                                  โ”‚
โ”‚  Claude Code โ†’ claude/ๅˆ†ๆ”ฏ โ†’ PR โ†’ main โ†’ auto_deploy โ†’ Mac Mini  โ”‚
โ”‚       config.yaml: ็ปŸไธ€้˜ˆๅ€ผ้…็ฝฎ๏ผˆ70+ๅ‚ๆ•ฐ๏ผŒ9ไธชๅˆ†ๅŒบ๏ผ‰               โ”‚
โ”‚       SLO 5ๆŒ‡ๆ ‡: ๅปถ่ฟŸp95<30s / ๅทฅๅ…ทๆˆๅŠŸ>95% / ้™็บง<5%            โ”‚
โ”‚                  ่ถ…ๆ—ถ<3% / ่‡ชๅŠจๆขๅค>90%                           โ”‚
โ”‚       auto_deploy: ๆ–‡ไปถๅŒๆญฅ(35ไธช) + ๆผ‚็งปๆฃ€ๆต‹ + ๆŒ‰้œ€restart        โ”‚
โ”‚       preflight: 19้กนๆฃ€ๆŸฅ๏ผˆๅ•ๆต‹+ๆณจๅ†Œ่กจ+่ฏญๆณ•+้ƒจ็ฝฒ+ๅฎ‰ๅ…จ+E2E+SLO๏ผ‰   โ”‚
โ”‚       ๆ•…้šœๅฟซ็…ง: ่ฟž็ปญ้”™่ฏฏโ†’่‡ชๅŠจ้‡‡้›†ๆ—ฅๅฟ—+็Šถๆ€โ†’~/.kb/incidents/        โ”‚
โ”‚       pre-commit: API key/ๆ‰‹ๆœบๅทๆณ„ๆผ+่ฏญๆณ•ๆฃ€ๆŸฅ                     โ”‚
โ”‚       GitHub Actions CI: 9ๅฅ—ๅ•ๆต‹+ๆณจๅ†Œ่กจ+้…็ฝฎๆ ก้ชŒ+ๅฎ‰ๅ…จๆ‰ซๆ+bandit  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  โ‘ค Ontology Plane๏ผˆ่ฏญไน‰ๆŽงๅˆถๅนณ้ข + ่ฟ่กŒๆ—ถๆฒป็† + ็Ÿฅ่ฏ†ไฝ“็ณป๏ผ‰           โ”‚
โ”‚                                                                  โ”‚
โ”‚  ontology/                                                       โ”‚
โ”‚    engine.py โ†โ†’ tool_ontology.yaml (81ๆกๅฃฐๆ˜Žๅผ่ง„ๅˆ™)              โ”‚
โ”‚      โ””โ†’ classify_tool_call(): ่ฏญไน‰ๆŽจ็†(ๅฑžๆ€งโ†’้ฃŽ้™ฉ+็ญ–็•ฅๆ ‡็ญพ)       โ”‚
โ”‚    governance_checker.py โ†โ†’ governance_ontology.yaml v3          โ”‚
โ”‚      โ””โ†’ 15ไธๅ˜ๅผ + 32ๆฃ€ๆŸฅ + 6ๅ…ƒ่ง„ๅˆ™ + ้ชŒ่ฏๆทฑๅบฆไธ‰ๅฑ‚ๆจกๅž‹           โ”‚
โ”‚      โ””โ†’ MRD-LAYER-001: ่‡ชๅŠจๅ‘็Žฐๅ•ๅฑ‚้ชŒ่ฏ็›ฒๅŒบ                     โ”‚
โ”‚    diff.py: engine โ†” proxy_filters ไธ€่‡ดๆ€งๆ ก้ชŒ (81/81=100%)      โ”‚
โ”‚    Phase 2 shadow: offโ†’shadowโ†’on (Mac Mini ็”Ÿไบง่ฟ่กŒไธญ)           โ”‚
โ”‚    CONSTITUTION.md: ๅฎชๆณ•6ๆก + ๆœ€้ซ˜ๆกๆฌพ๏ผˆ้กน็›ฎ้š”็ฆป๏ผ‰                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  โ‘ฅ ไธ‰ๆ–นๅ…ฑไบซ็Šถๆ€๏ผˆ~/.kb/status.json ๅฎžๆ—ถๅŒๆญฅ๏ผ‰                     โ”‚
โ”‚                                                                  โ”‚
โ”‚  ็”จๆˆท(WhatsApp+Discord) โ†โ†’ PA โ†โ†’ status.json โ†โ†’ Claude Code    โ”‚
โ”‚  ๅ้ฆˆ+ๅ†ณ็ญ–                 ๅ†™ๅ…ฅ    ไผ˜ๅ…ˆ็บง/ๅ้ฆˆ    ่ฏป/ๅ†™            โ”‚
โ”‚                                   ๅฅๅบท/SLO/็„ฆ็‚น  โ†โ†’ Cron่‡ชๅŠจๆ›ดๆ–ฐ  โ”‚
โ”‚                                                                  โ”‚
โ”‚  ๅฎชๆณ•๏ผš็”จๆˆทไธ“ไธšๆทฑๅบฆ + Claude Code่ฎพ่ฎก้ƒจ็ฝฒ + OpenClawๆ•ฐๆฎๅคๅˆฉ       โ”‚
โ”‚        ไธ‰่€…ๅˆไธ€ = ๆœ‰็”Ÿๅ‘ฝ็š„้—ญ็Žฏ็ณป็ปŸ                                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Component Port Files Role
OpenClaw Gateway 18789 npm global WhatsApp integration, media storage, tool execution, session management
Tool Proxy 5002 tool_proxy.py + proxy_filters.py Tool filtering (24โ†’12), custom tools (data_clean + search_kb hybrid search), image base64 injection, SSE conversion, truncation, token monitoring, SLO metrics collection, incident snapshots
Adapter 5001 adapter.py + providers.py 7-provider forwarding, auth, multimodal routing (textโ†’Qwen3, imageโ†’Qwen2.5-VL), fallback degradation
Config Center โ€” config.yaml + config_loader.py Centralized thresholds (70+ params, 9 sections: SLO/proxy/tokens/alerts/routing/truncation/watchdog/incidents/jobs)
SLO Benchmark โ€” slo_benchmark.py SLO compliance โ€” 5 metrics, real production data reports (p95=459ms, 5/5 PASS)
Notifications โ€” notify.sh Dual-channel push: WhatsApp + Discord (6 topic channels: papers/freight/alerts/daily/tech/DM)
Local Embedding โ€” local_embed.py sentence-transformers (384-dim, 50+ languages), zero API calls
Remote LLM โ€” 7 providers Qwen3-235B / GPT-4o / Gemini 2.5 / Claude Sonnet / Kimi K2.5 / MiniMax M2.7 / GLM-5

Supported Providers (7)

Provider Default Model Context Vision Auth Verified
Qwen (Remote GPU) Qwen3-235B 262K Qwen2.5-VL-72B Bearer 5/5 (production)
OpenAI GPT-4o 128K built-in Bearer available
Google Gemini Gemini 2.5 Flash 1M built-in Bearer 2/5 (fallback)
Anthropic Claude Claude Sonnet 4.6 200K built-in x-api-key available
Kimi (Moonshot AI) Kimi K2.5 (1T MoE) 256K built-in Bearer available
MiniMax MiniMax M2.7 200K built-in Bearer available
GLM (Zhipu AI) GLM-5 (744B MoE) 200K GLM-5V-Turbo Bearer available

All providers use OpenAI-compatible API format. Adding a new provider: see docs/compatibility_matrix.md.

# Switch provider at runtime
export PROVIDER=kimi && export MOONSHOT_API_KEY=... && bash restart.sh

Quick Start (10 minutes)

Three steps. Zero third-party dependencies. Any LLM provider.

# Step 1: Clone
git clone https://github.com/bisdom-cell/openclaw-model-bridge.git
cd openclaw-model-bridge

# Step 2: Set any ONE API key โ€” quickstart auto-detects your provider
export OPENAI_API_KEY="sk-..."           # OpenAI (GPT-4o)
export GEMINI_API_KEY="..."              # Google Gemini
export ANTHROPIC_API_KEY="sk-ant-..."    # Anthropic Claude
export MOONSHOT_API_KEY="..."            # Kimi (Moonshot AI)
export MINIMAX_API_KEY="..."             # MiniMax
export GLM_API_KEY="..."                 # GLM (Zhipu AI)
export REMOTE_API_KEY="..."              # Custom Qwen endpoint

# Step 3: One command โ€” auto-detects provider, runs 4 phases
bash quickstart.sh

What happens:

Phase 1: Prerequisites     โ†’ Python, files, syntax, provider auto-detection
Phase 2: Start Services    โ†’ Adapter(:5001) + Proxy(:5002), ~3 seconds
Phase 3: Health Check      โ†’ 610 unit tests + registry validation
Phase 4: Golden Test Trace โ†’ Real request through full stack, saved to docs/golden_trace.json

Expected output:

โœ… Provider: openai (via $OPENAI_API_KEY)
โœ… 610 tests passed
โœ… Golden test: "Four" in 521ms (37 prompt + 2 completion tokens)
   Trace saved to docs/golden_trace.json
Step-by-step alternative / ๅˆ†ๆญฅๆ‰ง่กŒ
bash quickstart.sh --check   # Prerequisites only
bash restart.sh              # Start services
bash quickstart.sh --demo    # Demo request only
After Quick Start: optional capabilities
# SLO Benchmark โ€” real production metrics report
python3 slo_benchmark.py          # Markdown report (5/5 PASS, p95=459ms)
python3 slo_benchmark.py --json   # JSON format for CI
python3 slo_benchmark.py --save   # Save to docs/slo_benchmark_report.md

# Provider compatibility matrix
python3 providers.py              # Markdown table (7 providers)
python3 providers.py --json       # JSON format

# GameDay fault injection drill
bash gameday.sh --all             # 5 scenarios: GPU timeout, circuit breaker, etc.

# KB RAG semantic search (requires pip install)
pip3 install -r requirements-rag.txt
python3 kb_embed.py && python3 kb_rag.py "AI papers"

# Multimodal memory search (requires pip install + Gemini key)
pip3 install -r requirements-mm.txt
python3 mm_index.py && python3 mm_search.py "cat photos"

Why Zero Dependencies?

Core services (tool_proxy.py, adapter.py, proxy_filters.py) use only Python standard library โ€” http.server, json, urllib. No pip install, no virtual environment, no Docker. This is a deliberate architecture decision: every dependency you remove is one fewer reason someone can't run your system.

Project Structure

Core Services

File Description
tool_proxy.py HTTP layer โ€” request/response routing, custom tool execution (data_clean + search_kb), media injection, followup LLM calls, logging, health cascade
proxy_filters.py Policy layer โ€” tool filtering, custom tool injection (data_clean + search_kb), image base64 injection (<media:image> โ†’ image_url), param fixing, truncation, SSE conversion
adapter.py API adapter โ€” 7-provider forwarding, auth, multimodal routing (textโ†’Qwen3, imageโ†’Qwen2.5-VL), fallback degradation
providers.py V34 Provider Compatibility Layer โ€” BaseProvider abstraction, 7 concrete providers, ProviderRegistry, capability declaration, CLI matrix
slo_benchmark.py V35 SLO Benchmark report generator โ€” reads proxy_stats.json โ†’ Markdown/JSON report (latency p50/p95/p99, success rate, degradation)
quickstart.sh V35 One-click Quick Start โ€” 4 phases (prerequisites โ†’ services โ†’ health โ†’ golden test), provider auto-detection
notify.sh V33 Unified notification โ€” WhatsApp + Discord dual-channel push, 6 topic channels

Knowledge Base & Local AI

File Description
local_embed.py V29.3 Local embedding engine โ€” sentence-transformers (multilingual-MiniLM, 384-dim, 50+ languages), zero API calls
kb_embed.py V29.3 KB text vector indexer โ€” notes+sources โ†’ chunking (400 chars, 80 overlap) โ†’ local embedding โ†’ ~/.kb/text_index/
kb_rag.py V29.3 RAG semantic search โ€” --context (LLM injection), --json (scripting), --top N, --source (filter by origin), --recent N (time-based)
mm_index.py V29.1 Multimodal memory indexer โ€” Gemini Embedding 2 for images/audio/video/PDF
mm_search.py V29.1 Multimodal semantic search โ€” text query โ†’ cosine similarity โ†’ matched media
kb_search.sh V29 KB full-text search โ€” keyword/tag/date/source filtering, --summary stats
kb_inject.sh V29 Daily KB digest generator โ€” ~/.kb/daily_digest.md for LLM context
kb_review.sh V29 Weekly KB deep review โ€” LLM cross-note analysis + WhatsApp push
kb_write.sh KB write utility โ€” directory lock + atomic write
kb_dedup.py V29.2 KB deduplication โ€” exact/fuzzy note dedup + source line dedup
kb_trend.py V29.5 Weekly AI trend report โ€” this week vs last week keywords + LLM analysis + prediction backtest
status_update.py V29.5 Three-party shared status โ€” atomic read/write of ~/.kb/status.json (Claude Code + PA + cron)
data_clean.py V30.3 Data cleaning CLI โ€” 7 operations (dedup/trim/fix_dates/etc), 5 formats (CSV/TSV/JSON/JSONL/Excel), version chain + audit log
SOUL.md V30.4 PA constitutional system prompt โ€” identity (Wei), three-party constitution, behavior directives, live project status

Monitoring, SLO & Quality

File Description
config.yaml V32 Centralized thresholds โ€” 70+ params across 9 sections (SLO/proxy/tokens/alerts/routing/truncation/watchdog/incidents/jobs)
config_loader.py V32 Config loader โ€” from config_loader import MAX_REQUEST_BYTES for backward compatibility
slo_checker.py V32 SLO compliance checker โ€” evaluates 5 SLO metrics from proxy_stats, outputs alerts for violations
incident_snapshot.py V32 Fault snapshot โ€” auto-collects proxy/adapter/gateway logs + stats + service status โ†’ ~/.kb/incidents/
conv_quality.py Daily conversation quality report โ€” response time, success rate, tool distribution, token usage
token_report.py Daily token usage report โ€” consumption, hourly distribution, context pressure, multi-day trends
job_watchdog.sh Meta-monitor โ€” checks all job status + log scanning โ†’ WhatsApp alerts on timeout/failure
wa_keepalive.sh WhatsApp session keepalive โ€” Gateway HTTP probe every 30 min

Operations

File Description
restart.sh One-command restart all services (with PATH fix for cron)
auto_deploy.sh Auto-deployment โ€” git pull + file sync (35 files) + drift detection + smart restart + post-deploy preflight
preflight_check.sh Pre-flight check โ€” 19 automated checks (tests, registry, syntax, deploy consistency, env vars, connectivity, security scan, data flow, crontab, E2E journey test, SLO compliance)
health_check.sh Weekly health report + JSON output
openclaw_backup.sh V29.1 Daily Gateway state backup to external SSD (7-day retention)
upgrade_openclaw.sh Gateway upgrade SOP (must run via SSH, never via WhatsApp)
gameday.sh V33 GameDay fault injection โ€” 5 scenarios (GPU timeout, circuit breaker, snapshot, SLO, watchdog)
smoke_test.sh End-to-end smoke test (unit tests + registry + doc drift + connectivity)

Scheduled Jobs (32 registered, 28 active)

All jobs registered in jobs_registry.yaml. Validate: python3 check_registry.py

File Schedule Description
jobs/arxiv_monitor/run_arxiv.sh Every 3h ArXiv AI paper monitoring + KB + WhatsApp
jobs/hf_papers/run_hf_papers.sh Daily 10:00 V30.5 HuggingFace Daily Papers + KB + WhatsApp
jobs/semantic_scholar/run_semantic_scholar.sh Daily 11:00 V30.5 Semantic Scholar papers (citation-ranked) + KB + WhatsApp
jobs/dblp/run_dblp.sh Daily 12:00 V30.5 DBLP CS papers (multi-keyword, free API) + KB + WhatsApp
jobs/acl_anthology/run_acl_anthology.sh Daily 09:30 V30.5 ACL Anthology NLP top-venue papers + KB + WhatsApp
run_hn_fixed.sh Every 3h:45 HackerNews hot posts scraper
jobs/freight_watcher/run_freight.sh 08/14/20:00 Freight intelligence โ€” scraping + LLM analysis
jobs/openclaw_official/run.sh Daily 08:00 OpenClaw releases watcher + LLM summary
jobs/openclaw_official/run_discussions.sh Hourly:15 GitHub Issues monitor (REST API + ETag)
kb_inject.sh Daily 07:00 KB daily digest for LLM context
kb_embed.py Every 4h:30 KB text vector indexing (local embedding)
kb_evening.sh Daily 22:00 Evening KB cleanup
kb_dedup.py Daily 23:00 KB deduplication (dry-run)
kb_review.sh Fri 21:00 Weekly KB deep review (LLM analysis)
mm_index_cron.sh Every 2h Multimodal memory indexing (Gemini)
conv_quality.py Daily 08:15 Conversation quality report
token_report.py Daily 08:20 Token usage report
health_check.sh Mon 09:00 Weekly health report
openclaw_backup.sh Daily 03:00 Gateway state backup
auto_deploy.sh Every 2 min Git โ†’ runtime auto-sync
job_watchdog.sh Every 4h:30 Job health monitoring
wa_keepalive.sh Every 30 min WhatsApp session probe
kb_trend.py Sat 09:00 Weekly AI trend report (keyword trends + LLM analysis)
jobs/github_trending/run_github_trending.sh Daily 14:00 V31 GitHub Trending ML/AI repos
jobs/rss_blogs/run_rss_blogs.sh 08:00/18:00 V31 RSS blog subscriptions (็ง‘ๅญฆ็ฉบ้—ด etc.)
kb_status_refresh.sh Hourly Status.json health refresh (three-party sync)
preference_learner.py Daily 07:30 User preference auto-learning
cron_canary.sh Every 10 min Cron heartbeat canary
kb_integrity.py (on-demand) KB file integrity checker (SHA256)

Configuration & Testing

File Description
jobs_registry.yaml Unified job registry โ€” 32 jobs (28 active, 4 disabled), system cron
check_registry.py Registry validator โ€” ID uniqueness, paths, fields
gen_jobs_doc.py Auto-generate job docs from registry + drift detection
test_providers.py Unit tests for providers (58 cases)
test_tool_proxy.py Unit tests for proxy_filters (70 cases)
test_check_registry.py Unit tests for check_registry (18 cases)
test_data_clean.py Unit tests for data_clean (80 cases)
test_adapter.py Unit tests for adapter (36 cases)
test_kb_business.py Unit tests for KB business logic (44 cases)
test_cron_health.py Unit tests for cron health (94 cases)
test_status_update.py Unit tests for status_update (33 cases)
test_audit_log.py Unit tests for audit_log (19 cases)
test_config_slo.py V32 Unit tests for config_loader + slo_checker + incident_snapshot + ProxyStats SLO (28 cases)
full_regression.sh Full regression runner โ€” 605 tests, all must pass before push
.githooks/pre-commit V32 Pre-commit hook โ€” API key/phone leak + syntax checks
.github/workflows/ci.yml V32 GitHub Actions CI โ€” 9 test suites + config validation + security scan
CLAUDE.md Project context for AI-assisted development

Ontology Sub-Project (V36.2)

File Description
ontology/engine.py V36.2 Tool Ontology Engine โ€” declarative rule inference (81 rules from proxy_filters.py), query/validate/suggest APIs
ontology/tool_ontology.yaml V36.2 Declarative tool rules โ€” 81 rules extracted from proxy_filters.py (filters, injections, truncation, SSE, media)
ontology/diff.py V36.2 Consistency checker โ€” compares engine rules vs proxy_filters.py behavior (81/81 = 100%)
ontology/poc_semantic_query.py V36.2 Semantic query PoC โ€” from enumeration to inference (the jump)
ontology/CONSTITUTION.md V36.2 Ontology Constitution โ€” 6 articles + Supreme Article (project isolation) + value assessment matrix
ontology/tests/test_engine.py V36.2 Engine unit tests
ontology/docs/ Knowledge base โ€” 16 files covering foundations (BFO/DOLCE/UFO), architecture (neuro-symbolic, enterprise), cases (OpenClaw), readings

Documentation

File Description
docs/compatibility_matrix.md V35 Provider compatibility matrix โ€” 7 providers, verification status, degradation paths
docs/slo_benchmark_report.md V35 SLO Benchmark production report โ€” 5/5 PASS, p95=459ms
docs/golden_trace.json V35 Golden Test Trace โ€” real request/response through full stack (521ms, reproducible)
docs/strategic_review_20260403.md V34 Strategic review โ€” Stage2 positioning, V1-V3 roadmap, methodology
docs/GUIDE.md Complete bilingual (CN/EN) integration guide with 26 lessons learned
docs/config.md Full system configuration + historical changelog
docs/openclaw_architecture.md OpenClaw upstream architecture reference (synced to v2026.3.23)
ROLLBACK.md Rollback guide โ€” 30-second recovery to v26

Methodology: Control Plane First

"The stronger capabilities get, the harder the system is to control โ€” governance must lead, not follow."

Three-Plane Architecture:

  • Control Plane (90%): Provider Compatibility Layer, SLO 5-metric monitoring, centralized thresholds, 19-check preflight, incident snapshots, circuit breaker, audit logging
  • Capability Plane (85%): 7-provider routing, multimodal (text+vision), tool governance (โ‰ค12), data cleaning, search_kb hybrid retrieval
  • Memory Plane (70%): KB RAG, trend analysis, preference learning, multimodal memory, Memory Plane v2 (dedup + confidence + conflict resolution)
  • Ontology Plane (new): Tool Ontology Engine (81 declarative rules), semantic query, enterprise AI knowledge base

SLO Benchmark Results (real production data)

Metric Target Actual Status
Latency p95 < 30s 459ms PASS
Tool success rate > 95% 100% PASS
Degradation rate < 5% 0% PASS
Timeout rate < 3% 0% PASS
Auto-recovery rate > 90% 100% PASS
python3 slo_benchmark.py --save   # Regenerate from live data โ†’ docs/slo_benchmark_report.md

Fallback & Circuit Breaker

Primary (e.g. Qwen3-235B, 5min timeout)
    โ†“ failure / timeout / circuit break (5 consecutive failures)
Fallback (e.g. Gemini 2.5 Flash, 1min timeout)
    โ†“ also failed
502 Error (both error messages returned)
    โ†“ 300s later: half-open, attempt recovery

Notification Channels

All job outputs push to both WhatsApp and Discord simultaneously via notify.sh:

source notify.sh
notify "New papers found"              # WhatsApp + Discord DM
notify "ArXiv digest" --topic papers   # WhatsApp + Discord #papers channel
notify "Deploy alert" --topic alerts   # WhatsApp + Discord #alerts channel
Discord Channel Content
#papers ArXiv, HF Papers, Semantic Scholar, DBLP, ACL
#freight Freight intelligence reports
#alerts Deploy alerts, watchdog, preflight failures
#daily KB digest, health reports, reviews
#tech HN, GitHub Trending, RSS blogs, OpenClaw releases

Key Rules

  1. Tools <= 12 โ€” more causes model confusion
  2. Tool calls per task <= 2 โ€” timeout risk increases exponentially
  3. Request body <= 200KB โ€” buffer from the 280KB hard limit
  4. --thinking values โ€” off, minimal, low, medium, high, adaptive (never use none)
  5. Model ID in openclaw.json โ€” must include qwen-local/ prefix
  6. API keys via env vars only โ€” never hardcode in source files

Local AI Capabilities (V29.3)

KB RAG Semantic Search (Zero API Calls)

# Build index (first time, or --reindex to rebuild)
python3 kb_embed.py                        # 4339 chunks in ~8s on Mac Mini

# Search
python3 kb_rag.py "Qwen3 ๆจกๅž‹"             # Top-5 results
python3 kb_rag.py --context "AI่ฎบๆ–‡"        # LLM-injectable format
python3 kb_rag.py --json "shipping"         # JSON for scripting
python3 kb_rag.py --top 10 "RAG pipeline"  # Custom top-K
python3 kb_rag.py --source arxiv "LLM"     # Filter by source (arxiv/hf/dblp/acl/hn/notes)
python3 kb_rag.py --recent 24              # What's new in last 24 hours

# Stats
python3 kb_embed.py --stats

Model: paraphrase-multilingual-MiniLM-L12-v2 (384-dim, 50+ languages) Performance on Mac Mini M-series: single ~10ms, batch 100 ~500ms, full index 137 files in 8.1s

Multimodal Memory Search (Gemini API)

python3 mm_index.py                    # Index media files
python3 mm_search.py "็Œซ็š„็…ง็‰‡"         # Semantic search
python3 mm_search.py --stats           # Index stats

Auto-Deployment

Claude Code โ†’ claude/branch โ†’ PR โ†’ main โ†’ auto_deploy (2 min) โ†’ Mac Mini
                                                โ†“
                               git pull โ†’ test โ†’ file sync (35 files) โ†’ smart restart
                                                โ†“
                               preflight_check.sh --full (19 checks)

The auto_deploy.sh script maps 35 repo files to runtime locations and only restarts services when core files change. Hourly drift detection via md5 checksums with WhatsApp alerts.

Testing

# Full regression (610 tests across 10 suites โ€” must ALL pass before push)
bash full_regression.sh

# Individual test suites
python3 test_providers.py               # 58 provider/registry tests
python3 test_tool_proxy.py              # 70 proxy_filters tests
python3 test_data_clean.py              # 80 data cleaning tests
python3 test_cron_health.py             # 94 cron health tests
python3 test_kb_business.py             # 44 KB business logic tests
python3 test_adapter.py                 # 36 adapter tests
python3 test_status_update.py           # 33 status update tests
python3 test_config_slo.py             # 28 config/SLO/incident tests
python3 test_audit_log.py               # 19 audit log tests
python3 test_check_registry.py          # 18 registry tests
python3 test_slo_benchmark.py           # 17 SLO benchmark tests

# SLO benchmark report (real production data)
python3 slo_benchmark.py                # Markdown: 5/5 PASS, p95=459ms
python3 slo_benchmark.py --save         # Save to docs/

# Provider compatibility matrix
python3 providers.py                    # 7-provider matrix
python3 providers.py --json             # JSON for CI

# GameDay fault injection (5 scenarios)
bash gameday.sh --all

# Pre-flight check (19 automated checks, on Mac Mini)
bash preflight_check.sh --full

# Security score (7-dimension, 100 points)
python3 security_score.py

Security

Run before every git push:

grep -r "sk-[A-Za-z0-9]\{15,\}" . --include="*.py" --include="*.sh" --include="*.md" | grep -v ".git"
grep -r "BSA[A-Za-z0-9]\{15,\}" . --include="*.py" --include="*.sh" --include="*.md" | grep -v ".git"
# All output must be empty

Evidence Chain

Evidence File How to reproduce
Golden Test Trace docs/golden_trace.json bash quickstart.sh --demo
SLO Benchmark docs/slo_benchmark_report.md python3 slo_benchmark.py --save
Compatibility Matrix docs/compatibility_matrix.md python3 providers.py
610 Unit Tests 10 test files python3 -m unittest discover -p "test_*.py"
GameDay Drill gameday.sh bash gameday.sh --all
Security Score security_score.py python3 security_score.py
Reliability Bench docs/reliability_bench_report.md python3 reliability_bench.py --save
Resilience Report docs/resilience_report.md 7 fault injection experiments
Security Boundaries docs/security_boundaries.md 8-section security analysis
Tool Ontology ontology/ python3 ontology/diff.py (81/81 consistency)

Articles

Article Language Platform
Why Agent Systems Need a Control Plane English dev.to
ไธบไป€ไนˆ Agent ็ณป็ปŸ้ฆ–ๅ…ˆ้œ€่ฆไธ€ไธชๆŽงๅˆถๅนณ้ข ไธญๆ–‡ ็ŸฅไนŽ

Full Guide

See docs/GUIDE.md for the complete bilingual walkthrough including 26 hard-won production lessons.

License

MIT

Release History

VersionChangesUrgencyDate
main@2026-04-21Latest activity on main branchHigh4/21/2026
0.0.0No release found โ€” using repo HEADHigh4/9/2026

Dependencies & License Audit

Loading dependencies...

Similar Packages

RustClawLean Rust AI agent: 6MB binary, 7.9MB RAM. OpenClaw replacement. Telegram + Discord + GitHub auto-PR. Ollama/Anthropic support.v0.5.0
openbrepOpenBrep: ็”จ่‡ช็„ถ่ฏญ่จ€้ฉฑๅŠจ ArchiCAD GDL ๅบ“ๅฏน่ฑก็š„ๅˆ›ๅปบใ€ไฟฎๆ”นไธŽ็ผ–่ฏ‘main@2026-04-21
GENesis-AGIAutonomous AI agent with persistent memory, self-learning, and earned autonomy. Cognitive partner that remembers, learns, and evolves.v3.0a7
clawmetrySee your agent think. Real-time observability dashboard for OpenClaw AI agents.v0.12.122
openclaw-qaOpenClaw Q&A ็คพๅŒบ โ€” AI Agent ่ฎฐๅฟ†็ณป็ปŸใ€ๅคšAgentๆžถๆž„ใ€่ฟ›ๅŒ–็ณป็ปŸใ€ๅ…ท่บซAI | ้พ™่™พ่Œถ้ฆ† ๐Ÿฆžmain@2026-04-10