OpenAI SDK
Using the OpenAI SDK
- Using
pip install openai - Using
npm i openai
import OpenAI from 'openai';
const openai = new OpenAI({
baseURL: 'https://llm.siraya.pro/v1',
apiKey: '<API_KEY>',
});
async function main() {
const completion = await openai.chat.completions.create({
model: '{{MODEL}}',
messages: [
{
role: 'user',
content: 'What is the meaning of life?',
},
],
});
console.log(completion.choices[0].message);
}
main();