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 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-08 13:15:29 -07:00
parent 54e6f13405
commit aca4dd0177
1 changed files with 8 additions and 0 deletions

View File

@ -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