// (f) vision: 32x32 PNG data URL on all 3 models (expect 400 on non-vision); tiny 2x2; detail:low; image in system message. import { raw, MODELS, save, pngDataUrl } from "./lib.ts"; const out: Record = {}; const img32 = pngDataUrl(32, 32); for (const model of MODELS) { const r = await raw("/chat/completions", { method: "POST", body: JSON.stringify({ model, max_tokens: 200, thinking: { type: "disabled" }, messages: [{ role: "user", content: [{ type: "text", text: "Describe this image in one sentence (colors, pattern)." }, { type: "image_url", image_url: { url: img32 } }] }] }) }); const b: any = r.body; out[`${model}|32x32`] = { status: r.status, content: b.choices?.[0]?.message?.content, usage: b.usage, error: r.status !== 200 ? b : undefined }; console.log(model, "32x32 →", r.status, JSON.stringify(b.choices?.[0]?.message?.content ?? b).slice(0, 200), JSON.stringify(b.usage ?? "")); } const v = "deepseek-v4-flash-vision-exp"; for (const [name, body] of Object.entries({ "2x2": { messages: [{ role: "user", content: [{ type: "text", text: "What color?" }, { type: "image_url", image_url: { url: pngDataUrl(2, 2) } }] }] }, "detail=low": { messages: [{ role: "user", content: [{ type: "text", text: "What color?" }, { type: "image_url", image_url: { url: img32, detail: "low" } }] }] }, "detail=original": { messages: [{ role: "user", content: [{ type: "text", text: "What color?" }, { type: "image_url", image_url: { url: img32, detail: "original" } }] }] }, "image_in_system": { messages: [{ role: "system", content: [{ type: "text", text: "You see:" }, { type: "image_url", image_url: { url: img32 } }] }, { role: "user", content: "What color?" }] }, "thinking+image": { thinking: { type: "enabled" }, reasoning_effort: "low", messages: [{ role: "user", content: [{ type: "text", text: "Dominant colors? one sentence." }, { type: "image_url", image_url: { url: img32 } }] }] }, "bad_image_bytes": { messages: [{ role: "user", content: [{ type: "text", text: "What color?" }, { type: "image_url", image_url: { url: "data:image/png;base64,AAAA" } }] }] }, })) { const r = await raw("/chat/completions", { method: "POST", body: JSON.stringify({ model: v, max_tokens: 200, thinking: { type: "disabled" }, ...body }) }); const b: any = r.body; out[`${v}|${name}`] = { status: r.status, content: b.choices?.[0]?.message?.content, reasoning_len: b.choices?.[0]?.message?.reasoning_content?.length ?? null, usage: b.usage, error: r.status !== 200 ? b : undefined }; console.log(v, name, "→", r.status, JSON.stringify(b.choices?.[0]?.message?.content ?? b).slice(0, 160), JSON.stringify(b.usage ?? "")); } save("05-vision.json", out);