Use the OpenAI SDK with the i14 API
Because the i14 API is fully OpenAI-compatible, you can use the official OpenAI SDK in Python or Node.js by changing only the base_url (Python) or baseURL (Node.js) and your API key. Everything else - your prompts, model parameters, and response handling - stays exactly the same.
Python
Section titled “Python”Install the OpenAI Python SDK if you have not already:
pip install openaiSugar Glider - general assistant
Section titled “Sugar Glider - general assistant”import openai
client = openai.OpenAI( base_url="https://api.i14.ai/v1", api_key="YOUR_I14_API_KEY",)
response = client.chat.completions.create( model="i14-sugarglider-nemotron3-super-120B-v1", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain the difference between a process and a thread."}, ], max_tokens=8192, stream=True,)
for chunk in response: if chunk.choices and chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="")Sugar Glider - coding tasks
Section titled “Sugar Glider - coding tasks”import openai
client = openai.OpenAI( base_url="https://api.i14.ai/v1", api_key="YOUR_I14_API_KEY",)
response = client.chat.completions.create( model="i14-sugarglider-nemotron3-super-120B-v1", messages=[ {"role": "system", "content": "You are an expert software engineer."}, {"role": "user", "content": "Write a Python function that reverses a string."}, ], max_tokens=8192, stream=True,)
for chunk in response: if chunk.choices and chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="")Node.js / TypeScript
Section titled “Node.js / TypeScript”Install the OpenAI Node.js SDK if you have not already:
npm install openaiSugar Glider - general assistant
Section titled “Sugar Glider - general assistant”import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.i14.ai/v1", apiKey: "YOUR_I14_API_KEY",});
const response = await client.chat.completions.create({ model: "i14-sugarglider-nemotron3-super-120B-v1", messages: [ { role: "system", content: "You are a helpful assistant." }, { role: "user", content: "Explain the difference between a process and a thread." }, ], max_tokens: 8192, stream: true,});
for await (const chunk of response) { process.stdout.write(chunk.choices[0]?.delta?.content ?? "");}Sugar Glider - coding tasks
Section titled “Sugar Glider - coding tasks”import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.i14.ai/v1", apiKey: "YOUR_I14_API_KEY",});
const response = await client.chat.completions.create({ model: "i14-sugarglider-nemotron3-super-120B-v1", messages: [ { role: "system", content: "You are an expert software engineer." }, { role: "user", content: "Write a TypeScript function that reverses a string." }, ], max_tokens: 8192, stream: true,});
for await (const chunk of response) { process.stdout.write(chunk.choices[0]?.delta?.content ?? "");}Environment Variables
Section titled “Environment Variables”Hardcoding your API key is fine for quick tests, but you should store it in an environment variable for any code you share or deploy.
Set the variable in your shell:
export I14_API_KEY="your-api-key-here"$env:I14_API_KEY = "your-api-key-here"Then read it in your code:
import osimport openai
client = openai.OpenAI( base_url="https://api.i14.ai/v1", api_key=os.environ["I14_API_KEY"],)import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.i14.ai/v1", apiKey: process.env.I14_API_KEY,});