-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-opencode-integration.js
More file actions
68 lines (53 loc) · 2.15 KB
/
test-opencode-integration.js
File metadata and controls
68 lines (53 loc) · 2.15 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
#!/usr/bin/env node
/**
* Test OpenCode integration with Talon
*/
import { createOpenCodeProviderNoAuth } from './dist/agent/providers/opencode.js';
const models = [
'minimax-m2.5-free',
'big-pickle',
'glm-5-free',
'kimi-k2.5-free',
];
async function testModel(modelId) {
console.log(`\n🧪 Testing ${modelId}...`);
const provider = createOpenCodeProviderNoAuth(modelId);
try {
const response = await provider.chat(
[{ role: 'user', content: `Say "Hello from ${modelId}" and nothing else.` }],
{ model: modelId, maxTokens: 50 }
);
console.log(` ✅ Success: ${response.content?.slice(0, 100) || '(empty)'}`);
console.log(` 📊 Tokens: ${response.usage?.totalTokens || 'N/A'}`);
return true;
} catch (error) {
console.log(` ❌ Failed: ${error.message}`);
return false;
}
}
async function runTests() {
console.log('╔════════════════════════════════════════╗');
console.log('║ OpenCode Integration Test ║');
console.log('║ (No Authorization Header) ║');
console.log('╚════════════════════════════════════════╝');
const results = [];
for (const model of models) {
const success = await testModel(model);
results.push({ model, success });
}
console.log('\n' + '═'.repeat(50));
console.log('📊 Results Summary:');
console.log('═'.repeat(50));
const passed = results.filter(r => r.success).length;
const total = results.length;
results.forEach(({ model, success }) => {
console.log(` ${success ? '✅' : '❌'} ${model}`);
});
console.log('\n' + `${passed}/${total} models working`);
if (passed === total) {
console.log('\n🎉 All OpenCode models integrated successfully!\n');
} else {
console.log('\n⚠️ Some models failed - check rate limits or availability\n');
}
}
runTests().catch(console.error);