To get started, choose your preferred programming language. Next, open a terminal and run the command to install the SambaNova SDK.
//ensure you have Node.js installed.npm install sambanova
Next, copy the following code into a new file.
import SambaNova from "sambanova";const client = new SambaNova({ baseURL: "https://api.infercom.ai/v1", apiKey: "your-infercom-api-key",});const chatCompletion = await client.chat.completions.create({ messages: [ { role: "system", content: "Answer the question in a couple sentences." }, { role: "user", content: "Share a happy story with me" }, ], model: "MiniMax-M2.5",});console.log(chatCompletion.choices[0].message.content);
After copying the code into the file, replace the placeholder "your-infercom-api-key" with your actual API key. Then, run the file in a terminal using the command shown below.
node hello-world.js
After running the program, you should see output similar to the example shown below.
Here’s a happy story: One day, a little girl named Sophie found a lost puppy in her neighborhood and decided to take it home to care for it. As she nursed the puppy back to health, she named it Max and the two became inseparable best friends, going on adventures and playing together every day.
To get started, select your preferred programming language. Then, open a terminal window and run the command to install the OpenAI library.
//ensure you have Node.js installed.npm install openai
Next, copy the following code into a new file.
import OpenAI from "openai";const client = new OpenAI({ baseURL: "https://api.infercom.ai/v1", apiKey: "your-infercom-api-key",});const chatCompletion = await client.chat.completions.create({ messages: [ { role: "system", content: "Answer the question in a couple sentences." }, { role: "user", content: "Share a happy story with me" }, ], model: "MiniMax-M2.5",});console.log(chatCompletion.choices[0].message.content);
Once copied into the file, replace the placeholder "your-infercom-api-key" with your API key. Then run the file with the command below in a terminal window.
node hello-world.js
After you run the program, you should now see an output like similar to the one below.
Here’s a happy story: One day, a little girl named Sophie found a lost puppy in her neighborhood and decided to take it home to care for it. As she nursed the puppy back to health, she named it Max and the two became inseparable best friends, going on adventures and playing together every day.
Now that you can make requests to a model, great potential of building AI-powered applications await. Get inspired of what to build by exploring our AI Starter Kits, a collection of open-source Python projects.