quick-test-llm.ts 980 B

12345678910111213141516171819202122232425262728
  1. import axios from 'axios';
  2. async function test(name: string, url: string, key: string, model: string) {
  3. try {
  4. const r = await axios.post(url, {
  5. model, messages: [{role:'user',content:'hi'}], max_tokens: 10
  6. }, {
  7. headers: {'Authorization':`Bearer ${key}`,'Content-Type':'application/json'},
  8. timeout: 8000
  9. });
  10. console.log(`${name}: ✅ ${r.status}`);
  11. } catch(e: any) {
  12. console.log(`${name}: ❌ ${e.response?.status || e.message?.substring(0,60)}`);
  13. }
  14. }
  15. async function main() {
  16. // Test qwen
  17. await test('qwen', 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
  18. 'sk-c25679401ba24c749f53be86b0c9a7a6', 'qwen3.5-flash');
  19. // Test MiniMax (quota exhausted, just to verify)
  20. await test('minimax', 'https://api.minimax.chat/v1/chat/completions',
  21. 'sk-cp-s8hGJr4ACdlZ4GM0LjZ1l2ZNBUAMGwd2ahl0c3W2g6C0EiNH0UvwOBx2q0oJOYO6ca5HqJccP_KRUPucoBizavlwDSZp-ohOGeUw2ymAdXPuM6r3CIDmmlY',
  22. 'MiniMax-M2.7');
  23. }
  24. main();