Files
scan-receipts/scripts/test_openrouter.mjs
Timo 84b9987c49 Add full application: receipt scanning, auth, billing, and account deletion
Brings the working codebase (Next.js app, auth system, Stripe billing,
Docker/deploy config, tests, docs) into version control on top of the
placeholder initial commit, and adds account self-deletion (Danger Zone
in Settings, password + typed-email confirmation, cascading DB cleanup,
Stripe cancellation) per GDPR right-to-erasure.

Excludes local build caches, node_modules, and internal agent scratch
files; .gitignore hardened to keep those out going forward.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-19 20:59:04 +02:00

37 lines
1.1 KiB
JavaScript

import fs from "fs";
import path from "path";
const envContent = fs.readFileSync(".env.local", "utf-8");
const apiKeyMatch = envContent.match(/OPENROUTER_API_KEY=([^\r\n]+)/);
const apiKey = apiKeyMatch ? apiKeyMatch[1].trim() : "";
console.log("Testing OpenRouter with key:", apiKey ? apiKey.substring(0, 15) + "..." : "NONE");
async function testOpenRouter() {
// Test 1: List models or check deepseek/deepseek-v4-flash
const res = await fetch("https://openrouter.ai/api/v1/chat/completions", {
method: "POST",
headers: {
"Authorization": `Bearer ${apiKey}`,
"Content-Type": "application/json",
"HTTP-Referer": "http://localhost:3000",
"X-Title": "Receipt Scanner",
},
body: JSON.stringify({
model: "deepseek/deepseek-v4-flash",
messages: [
{
role: "user",
content: "Sag einfach 'Hallo, DeepSeek V4 Flash ist bereit!'"
}
]
})
});
console.log("Status:", res.status, res.statusText);
const data = await res.json();
console.log("Response:", JSON.stringify(data, null, 2));
}
testOpenRouter().catch(console.error);