// Responses API end-to-end test through the proxy (UTF-8 safe). import { readFileSync } from "node:fs"; const B64 = readFileSync("C:/Users/12914/Desktop/vscode/.mimo2codex-audit/red64.png").toString("base64"); async function responsesTest(model, content) { const item = typeof content === "string" ? { type: "message", role: "user", content } : { type: "message", role: "user", content }; const res = await fetch("http://127.0.0.1:8788/v1/responses", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ model, stream: false, input: [item] }), }); const j = await res.json().catch(() => null); const msg = j?.output?.find((o) => o.type === "message"); const text = msg?.content?.find((c) => c.type === "output_text")?.text; return { status: res.status, text: text?.slice(0, 160), err: j?.error?.message?.slice(0, 200) }; } // 1. multimodal to mimo-v2.5 (vision-capable, Responses wire) const r1 = await responsesTest("mimo-v2.5", [ { type: "input_text", text: "这张图片是什么颜色?只回答颜色词。" }, { type: "input_image", image_url: `data:image/png;base64,${B64}` }, ]); console.log("mimo-v2.5 + image :", JSON.stringify(r1)); // 2. plain text to mimo-v2.5 const r2 = await responsesTest("mimo-v2.5", "只回答一个数字:6+6=?"); console.log("mimo-v2.5 text :", JSON.stringify(r2)); // 3. image to kimi-k3 (vision-capable upstream but translator strips for non-mimo) — expect OCR note const r3 = await responsesTest("kimi-k3", [ { type: "input_text", text: "这张图片是什么颜色?" }, { type: "input_image", image_url: `data:image/png;base64,${B64}` }, ]); console.log("kimi-k3 + image :", JSON.stringify(r3)); // 4. image to glm-5.3 (non-vision) — expect OCR strip note const r4 = await responsesTest("glm-5.3", [ { type: "input_text", text: "这张图片是什么颜色?" }, { type: "input_image", image_url: `data:image/png;base64,${B64}` }, ]); console.log("glm-5.3 + image :", JSON.stringify(r4));