27 lines
797 B
JavaScript
27 lines
797 B
JavaScript
import { createServer } from 'node:http';
|
|
|
|
async function test() {
|
|
const LLM_ENDPOINT = 'https://api.minimax.io/v1';
|
|
const LLM_API_KEY = process.env.MINIMAX_API_KEY;
|
|
const LLM_MODEL = 'MiniMax-M3';
|
|
|
|
const resp = await fetch(LLM_ENDPOINT + '/chat/completions', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
Authorization: `Bearer ${LLM_API_KEY}`
|
|
},
|
|
body: JSON.stringify({
|
|
model: LLM_MODEL,
|
|
max_tokens: 120,
|
|
messages: [
|
|
{ role: 'system', content: 'You are a Suno style-prompt generator.' },
|
|
{ role: 'user', content: 'Generate one style description now.' }
|
|
]
|
|
})
|
|
});
|
|
const data = await resp.json();
|
|
console.log(JSON.stringify(data.choices?.[0]?.message?.content));
|
|
}
|
|
test().catch(console.error);
|