Integrations
Node.js SDK
Use the OpenAI JavaScript SDK with Your Model.
import OpenAI from 'openai';
const apiKey = process.env.YOURMODEL_API_KEY;
if (!apiKey) {
throw new Error('YOURMODEL_API_KEY is not set');
}
const client = new OpenAI({
apiKey,
baseURL: 'https://y-models.com/v1',
});
const response = await client.chat.completions.create({
model: 'YOUR_MODEL_ID',
messages: [
{
role: 'user',
content: 'Hello',
},
],
});
console.log(response.choices[0].message.content);Use environment variables for keys and copy the model ID from /v1/models.