-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind-working-model.html
More file actions
87 lines (80 loc) · 3.98 KB
/
find-working-model.html
File metadata and controls
87 lines (80 loc) · 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html>
<head>
<title>Find Working OpenRouter Model</title>
</head>
<body>
<h1>Find Working OpenRouter Model</h1>
<p>Test different models to find one that works with your API key:</p>
<div style="margin: 20px 0;">
<h3>Test Common Models:</h3>
<button onclick="testModel('microsoft/phi-3-mini-128k-instruct:free')">Test Phi-3 Mini (Free)</button>
<button onclick="testModel('google/gemma-2-9b-it:free')">Test Gemma 2 (Free)</button>
<button onclick="testModel('meta-llama/llama-3.1-8b-instruct:free')">Test Llama 3.1 (Free)</button>
<button onclick="testModel('openai/gpt-3.5-turbo')">Test GPT-3.5 (Paid)</button>
<button onclick="testModel('anthropic/claude-3-haiku')">Test Claude Haiku (Paid)</button>
<button onclick="testModel('mistralai/mistral-7b-instruct:free')">Test Mistral 7B (Free)</button>
</div>
<div id="result"></div>
<script>
const API_KEY = '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';
async function testModel(modelName) {
const result = document.getElementById('result');
result.innerHTML = `Testing ${modelName}...`;
try {
const response = await fetch('https://openrouter.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
'HTTP-Referer': 'https://localhost:5173',
'X-Title': 'Chatbot Test'
},
body: JSON.stringify({
model: modelName,
messages: [
{
role: "user",
content: "Hello! Say hi back in one sentence."
}
],
max_tokens: 50,
temperature: 0.7
})
});
const data = await response.json();
console.log(`${modelName} response:`, data);
if (response.ok && data.choices && data.choices[0]) {
result.innerHTML = `
<div style="color: green; border: 2px solid green; padding: 20px; margin: 10px 0;">
<h3>🎉 ${modelName} WORKS!</h3>
<p><strong>Response:</strong> ${data.choices[0].message.content}</p>
<p><strong>Model Used:</strong> ${data.model}</p>
<div style="background: #f0f8f0; padding: 10px; margin: 10px 0;">
<strong>✅ Use this model in your n8n workflow:</strong><br>
<code style="background: #e0e0e0; padding: 5px;">${modelName}</code>
</div>
<p><strong>Usage:</strong> ${JSON.stringify(data.usage || 'No usage info')}</p>
</div>
`;
} else {
result.innerHTML = `
<div style="color: red; border: 1px solid red; padding: 15px; margin: 10px 0;">
<h3>❌ ${modelName} FAILED</h3>
<p><strong>Status:</strong> ${response.status}</p>
<p><strong>Error:</strong> ${data.error?.message || JSON.stringify(data)}</p>
</div>
`;
}
} catch (error) {
result.innerHTML = `
<div style="color: red; border: 1px solid red; padding: 15px; margin: 10px 0;">
<h3>❌ ${modelName} ERROR</h3>
<p>${error.message}</p>
</div>
`;
}
}
</script>
</body>
</html>