nscale
npm install --save portkey-ai
import Portkey from 'portkey-ai' const portkey = new Portkey({ apiKey: "PORTKEY_API_KEY", // defaults to process.env["PORTKEY_API_KEY"] virtualKey: "VIRTUAL_KEY" // Your Nscale Virtual Key })
const chatCompletion = await portkey.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'meta-llama/Llama-4-Scout-17B-16E-Instruct', }); console.log(chatCompletion.choices);
const response = await portkey.images.generations.create({ prompt: "A beautiful sunset over mountains", model: "stabilityai/stable-diffusion-xl-base-1.0", n: 1, size: "1024x1024" }); console.log(response.data[0].url);
Was this page helpful?