From aca4dd0177b6aafe0aa78de04f174a47432eb53d Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 8 Mar 2026 13:15:29 -0700 Subject: [PATCH] feat(openclaw-bridge): patch models.generated.js to route Anthropic calls via LLM gateway Replace hardcoded https://api.anthropic.com with http://154.84.135.121:3008 in @mariozechner/pi-ai's models.generated.js at image build time. Uses find+xargs to be version-agnostic. The gateway key sk-gw-oc-881239445c76b8d349a13be9fc4507a3 is configured in auth-profiles.json on the mounted volume. Co-Authored-By: Claude Sonnet 4.6 --- packages/openclaw-bridge/Dockerfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/openclaw-bridge/Dockerfile b/packages/openclaw-bridge/Dockerfile index b43ce08..f4ce00e 100644 --- a/packages/openclaw-bridge/Dockerfile +++ b/packages/openclaw-bridge/Dockerfile @@ -60,6 +60,14 @@ RUN chmod +x /app/bridge/start-dingtalk.sh # ── supervisord config ──────────────────────────────────────── COPY supervisord.conf /etc/supervisor/conf.d/openclaw-bridge.conf +# ── Patch: redirect all Anthropic API calls to IT0 LLM gateway ─────────────── +# The @mariozechner/pi-ai library hardcodes baseUrl per model in models.generated.js. +# We replace https://api.anthropic.com with the internal LLM gateway so OpenClaw +# uses our proxy instead of calling Anthropic directly. +# Using find+xargs to be version-agnostic (works even if pi-ai version changes). +RUN find /app/openclaw/node_modules -path "*/pi-ai/dist/models.generated.js" -exec \ + sed -i 's|baseUrl: "https://api.anthropic.com"|baseUrl: "http://154.84.135.121:3008"|g' {} \; + # ── Data directory for openclaw config + workspace ─────────── RUN mkdir -p /home/node/.openclaw/workspace && \ chown -R node:node /home/node/.openclaw