diff --git a/Dockerfile b/Dockerfile
index b1a164e..f821714 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -31,8 +31,10 @@ COPY assets/maskable-icon.png /app/code/librechat/client/dist/assets/maskable-ic
# Copy custom branding CSS
COPY assets/custom.css /app/code/librechat/client/dist/assets/custom.css
-# Insert the CSS link after the title tag
-RUN sed -i '/
Inference Co-op<\/title>/a ' /app/code/librechat/client/dist/index.html
-
-# Insert custom CSS link before closing
-RUN sed -i '/<\/head>/i ' /app/code/librechat/client/dist/index.html
+# Copy optional helper JS (auto‑load API key)
+COPY assets/custom.js /app/code/librechat/client/dist/assets/custom.js
+# Apply branding patch to the *source* index.html before the container copies it
+COPY client/index.html.patch /tmp/index.html.patch
+RUN cd /app/code/librechat/client && \
+ patch -p0 < /tmp/index.html.patch && \
+ rm /tmp/index.html.patch
diff --git a/assets/custom.js b/assets/custom.js
new file mode 100644
index 0000000..6d8d07d
--- /dev/null
+++ b/assets/custom.js
@@ -0,0 +1,8 @@
+// Auto‑load saved image generation API key into the MCP input field
+window.addEventListener('load', () => {
+ const savedKey = localStorage.getItem('image_api_key');
+ if (savedKey) {
+ const icInput = document.querySelector('input[name="IC_API_KEY"]');
+ if (icInput) icInput.value = savedKey;
+ }
+});
diff --git a/client/index.html.patch b/client/index.html.patch
new file mode 100644
index 0000000..3a24d75
--- /dev/null
+++ b/client/index.html.patch
@@ -0,0 +1,6 @@
+--- a/client/index.html
++++ b/client/index.html
+@@
+- LibreChat
++ Inference Co‑op
++