28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
import { readFileSync } from "node:fs";
|
|
const envText = readFileSync("C:/Users/12914/.mimo2codex/.env", "utf8");
|
|
const KEY = envText.match(/^MIMO_API_KEY=(.+)$/m)?.[1]?.trim();
|
|
const BASE = "https://opencode.ai/zen/go/v1";
|
|
const B64 = readFileSync("C:/Users/12914/Desktop/vscode/.mimo2codex-audit/red64.png").toString("base64");
|
|
|
|
for (const m of ["deepseek-v4-pro", "longcat-2.0", "hy4-preview"]) {
|
|
const res = await fetch(`${BASE}/chat/completions`, {
|
|
method: "POST",
|
|
headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json" },
|
|
body: JSON.stringify({
|
|
model: m,
|
|
messages: [{
|
|
role: "user",
|
|
content: [
|
|
{ type: "text", text: "这张图片是什么颜色?只回答颜色词。" },
|
|
{ type: "image_url", image_url: { url: `data:image/png;base64,${B64}` } },
|
|
],
|
|
}],
|
|
max_tokens: 500,
|
|
stream: false,
|
|
}),
|
|
});
|
|
const j = await res.json().catch(() => null);
|
|
console.log(`=== ${m} (${res.status}) ===`);
|
|
console.log(JSON.stringify(j?.choices?.[0]?.message ?? j, null, 2).slice(0, 900));
|
|
}
|