From af7ca4baf7d6ff238b5b9ba222ee2607b8a0b8e1 Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Sun, 8 Mar 2026 02:17:21 -0300 Subject: [PATCH] fix: strip only internal prefix from model name for compatible providers (#243) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed model.split('/').pop() to model.split('/').slice(1).join('/') - Preserves vendor namespace in model names (e.g. moonshotai/Kimi-K2-Instruct) - Also fixes multimodal image_url → input_image conversion for Responses API (#242) - image_url parts from Chat Completions are now properly converted to input_image format --- open-sse/executors/default.ts | 2 +- open-sse/translator/request/openai-responses.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/open-sse/executors/default.ts b/open-sse/executors/default.ts index c2b3ef2a68..24f1e2ab8f 100644 --- a/open-sse/executors/default.ts +++ b/open-sse/executors/default.ts @@ -82,7 +82,7 @@ export class DefaultExecutor extends BaseExecutor { this.provider?.startsWith?.("openai-compatible-") || this.provider?.startsWith?.("anthropic-compatible-") ) { - const cleanModel = model.includes("/") ? model.split("/").pop() : model; + const cleanModel = model.includes("/") ? model.split("/").slice(1).join("/") : model; return { ...body, model: cleanModel }; } return body; diff --git a/open-sse/translator/request/openai-responses.ts b/open-sse/translator/request/openai-responses.ts index c623086316..b4b3b4709f 100644 --- a/open-sse/translator/request/openai-responses.ts +++ b/open-sse/translator/request/openai-responses.ts @@ -261,7 +261,13 @@ export function openaiToOpenAIResponsesRequest( if (contentItem.type === "text") { return { type: "input_text", text: toString(contentItem.text) }; } - if (contentItem.type === "image_url") return contentValue; // passthrough images + if (contentItem.type === "image_url") { + const imgUrl = contentItem.image_url as string | { url?: string }; + return { + type: "input_image", + image_url: typeof imgUrl === "string" ? imgUrl : imgUrl?.url || "", + }; + } return contentValue; }) : [{ type: "input_text", text: "" }];