外观
nodejs 基础对话
bash
npm i openai1
js
const fs = require('fs');
const OpenAI = require('openai');
const openai = new OpenAI({
apiKey: 'sk-xxxxxxxx',
baseURL: 'https://www.aipro2.com/v1'
});
async function transcribeAudio() {
try {
const transcription = await openai.audio.transcriptions.create({
file: fs.createReadStream('a-product-demo-167264.mp3'), // 替换为你的音频文件路径
model: 'whisper-1',
});
console.log('转录结果:', transcription.text);
} catch (error) {
console.error('转录出错:', error);
}
}
transcribeAudio();1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
