Skip to content

Use the OpenAI SDK with the i14 API

Use the official OpenAI SDK from Python or Node.js to call i14. Set the base URL to https://api.i14.ai/v1, pass your i14 API key, and choose a model ID your key can use. These examples use Chat Completions. Check the API reference before reusing code that depends on another endpoint or a model-specific feature.

Install the OpenAI Python SDK if you have not already:

pip install openai
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="")
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="")

Install the OpenAI Node.js SDK if you have not already:

npm install openai
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 ?? "");
}
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 ?? "");
}

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:

bash or zsh
export I14_API_KEY="your-api-key-here"

Then read it in your code:

import os
import openai
client = openai.OpenAI(
base_url="https://api.i14.ai/v1",
api_key=os.environ["I14_API_KEY"],
)