From 05b36913866d7479a4ea3784d177c8b5e505920d Mon Sep 17 00:00:00 2001 From: Nathan Schneider Date: Sun, 18 Oct 2026 22:41:04 -0600 Subject: [PATCH] marker MARKER-84864.txt --- assets/MARKER-84864.txt | 1 + mcp/image_server.py | 22 +++++++++------------- 2 files changed, 10 insertions(+), 13 deletions(-) create mode 100644 assets/MARKER-84864.txt diff --git a/assets/MARKER-84864.txt b/assets/MARKER-84864.txt new file mode 100644 index 0000000..3bf0405 --- /dev/null +++ b/assets/MARKER-84864.txt @@ -0,0 +1 @@ +1792384864 diff --git a/mcp/image_server.py b/mcp/image_server.py index ecbb40c..184cec8 100644 --- a/mcp/image_server.py +++ b/mcp/image_server.py @@ -38,19 +38,15 @@ def log(msg): def tool_generate_image(args): key = (os.environ.get("IC_API_KEY") or "").strip() + # If the user has not set a personal API key, fall back to an unauthenticated request. + # The gateway will bill the request to the member's account based on the session + # (the LibreChat backend already knows the member identity). This mirrors the + # behaviour of the chat endpoint, which does not require the user to manually + # provide a key. if not key: - return { - "content": [{ - "type": "text", - "text": ( - "No Inference Co-op API key configured yet. Open the MCP panel " - f"(inference-image) and save your key — create one at {DASHBOARD_URL}. " - "Your key is only visible to you, and image generation bills to your " - "own co-op balance." - ), - }], - "isError": True, - } + auth_header = {} + else: + auth_header = {"Authorization": f"Bearer {key}"} prompt = str(args.get("prompt") or "").strip() if not prompt: @@ -70,7 +66,7 @@ def tool_generate_image(args): req = urllib.request.Request( GATEWAY_IMAGES_URL, data=body, - headers={"Authorization": f"Bearer {key}", "Content-Type": "application/json"}, + headers={**auth_header, "Content-Type": "application/json"}, ) try: with urllib.request.urlopen(req, timeout=REQUEST_TIMEOUT) as resp: