import { readFileSync } from 'node:fs' import { homedir } from 'node:os' import { join } from 'node:path' const cfg = JSON.parse(readFileSync(join(homedir(), 'Documents/Essay_AI/Essay_system/dsh-markmag/.local-credentials.json'), 'utf8')) const key = cfg.key1 const BASE = 'https://brain.sidaocai.cn' async function call(name, url, headers, body) { const t0 = Date.now() try { const res = await fetch(url, { method: 'POST', headers: { 'content-type': 'application/json', ...headers }, body: JSON.stringify(body), signal: AbortSignal.timeout(60000) }) const text = await res.text() console.log(`[${name}] ${res.status} ${Date.now() - t0}ms :: ${text.slice(0, 300).replace(/\n/g, ' ')}`) } catch (e) { console.log(`[${name}] FAIL ${e.name}: ${e.message}`) } } const H_ANTH = { 'x-api-key': key, 'anthropic-version': '2023-06-01' } const H_OAUTH = { authorization: 'Bearer ' + key } // A. 弹匣链路 + glm-5.3 await call('A-anthropic/glm-5.3', BASE + '/tdb-api/claude-code/default/v1/messages', H_ANTH, { model: 'glm-5.3', max_tokens: 32, messages: [{ role: 'user', content: '只回复两个字:在的' }] }) // B. DSH 链路 + 团队头 + glm-5.3 await call('B-dsh/glm-5.3+headers', BASE + '/tdb-api/dsh/default/chat/completions', { ...H_OAUTH, 'x-team-id': 'team-oek7kp1cy7', 'x-agent-id': 'agt-of5x44h7ns' }, { model: 'glm-5.3', max_tokens: 32, messages: [{ role: 'user', content: '只回复两个字:在的' }] }) // C. DSH 链路不带头 await call('C-dsh/glm-5.3-no-header', BASE + '/tdb-api/dsh/default/chat/completions', H_OAUTH, { model: 'glm-5.3', max_tokens: 32, messages: [{ role: 'user', content: '只回复两个字:在的' }] })