const https = require('https'); const BASE_URL = 'https://s2a.bbx.qzz.io'; const TOKEN = 'sk-b2ff52c85b4a654733d25bd7fc85f52d70fe7900613ae681a070b5e5ed880e47'; function testRequest(headers) { return new Promise((resolve, reject) => { const urlObj = new URL('/v1/models', BASE_URL); const options = { hostname: urlObj.hostname, port: 443, path: urlObj.pathname, method: 'GET', headers: { 'Authorization': 'Bearer ' + TOKEN, ...headers } }; console.log('Testing with headers:', JSON.stringify(headers, null, 2)); const req = https.request(options, (res) => { let data = ''; res.on('data', chunk => data += chunk); res.on('end', () => { console.log(`Status: ${res.statusCode}`); console.log('Response headers:', res.headers); if (data) { console.log('Response body:', data.slice(0, 500)); } resolve({ status: res.statusCode, headers: res.headers, body: data }); }); }); req.on('error', reject); req.end(); }); } async function runTests() { console.log('=== Test 1: Cherry Studio User-Agent only ==='); await testRequest({ 'User-Agent': 'cherry studio/1.0(secure client)' }); console.log('\n=== Test 2: Modern Chrome browser ==='); await testRequest({ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36', 'Accept': 'application/json, text/plain, */*', 'Accept-Language': 'en-US,en;q=0.9', 'Accept-Encoding': 'gzip, deflate, br', 'Referer': 'https://chat.openai.com/', 'Origin': 'https://chat.openai.com', 'Sec-Fetch-Dest': 'empty', 'Sec-Fetch-Mode': 'cors', 'Sec-Fetch-Site': 'same-origin', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache' }); console.log('\n=== Test 3: More complete browser headers ==='); await testRequest({ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36', 'Accept': 'application/json, text/plain, */*', 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8', 'Accept-Encoding': 'gzip, deflate, br', 'Referer': 'https://platform.openai.com/', 'Origin': 'https://platform.openai.com', 'Sec-Ch-Ua': '"Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"', 'Sec-Ch-Ua-Mobile': '?0', 'Sec-Ch-Ua-Platform': '"Windows"', 'Sec-Fetch-Dest': 'empty', 'Sec-Fetch-Mode': 'cors', 'Sec-Fetch-Site': 'same-site', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache', 'Pragma': 'no-cache' }); } runTests().catch(console.error);