Skip to main content

Documentation Index

Fetch the complete documentation index at: https://student-213fb9fc.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Installation

npm install openai
# or
yarn add openai
# or
pnpm add openai

Basic Setup

import OpenAI from "openai";

const openai = new OpenAI({
  baseURL: "https://api.ajstudioz.co.in/v1",
  apiKey: process.env.AJSTUDIOZ_API_KEY,
});

Chat Completions

const response = await openai.chat.completions.create({
  model: "gemma3:27b",
  messages: [
    { role: "system", content: "You are a helpful assistant." },
    { role: "user", content: "What is the difference between TCP and UDP?" }
  ],
  temperature: 0.7,
  max_tokens: 500,
});

console.log(response.choices[0].message.content);

Streaming

const stream = await openai.chat.completions.create({
  model: "deepseek-v3.2",
  messages: [{ role: "user", content: "Explain async/await in JavaScript." }],
  stream: true,
});

for await (const chunk of stream) {
  const content = chunk.choices[0]?.delta?.content ?? "";
  process.stdout.write(content);
}
console.log();

Function Calling

const tools = [
  {
    type: "function",
    function: {
      name: "get_current_time",
      description: "Get the current time in a specific timezone",
      parameters: {
        type: "object",
        properties: {
          timezone: {
            type: "string",
            description: "Timezone name, e.g. UTC, America/New_York"
          }
        },
        required: ["timezone"]
      }
    }
  }
];

const response = await openai.chat.completions.create({
  model: "qwen3-coder:480b",
  messages: [{ role: "user", content: "What time is it in Tokyo?" }],
  tools,
  tool_choice: "auto",
});

const toolCall = response.choices[0].message.tool_calls?.[0];
if (toolCall) {
  console.log(`Calling: ${toolCall.function.name}`);
  console.log(`Args: ${toolCall.function.arguments}`);
}

Embeddings

const response = await openai.embeddings.create({
  model: "gemma3:4b",
  input: "AJ STUDIOZ Cloud Infra — cloud AI inference",
});

const embedding = response.data[0].embedding;
console.log(`Embedding dimension: ${embedding.length}`);

TypeScript Usage

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.ajstudioz.co.in/v1",
  apiKey: process.env.AJSTUDIOZ_API_KEY!,
});

async function chat(userMessage: string, model = "gemma3:27b"): Promise<string> {
  const response = await client.chat.completions.create({
    model,
    messages: [{ role: "user", content: userMessage }],
  });
  return response.choices[0].message.content ?? "";
}

// Usage
const answer = await chat("Tell me about Large Language Models");
console.log(answer);

Environment Setup

export AJSTUDIOZ_API_KEY="your-api-key-here"
Or use a .env file with dotenv:
AJSTUDIOZ_API_KEY=your-api-key-here
import "dotenv/config";
import OpenAI from "openai";

const openai = new OpenAI({
  baseURL: "https://api.ajstudioz.co.in/v1",
  apiKey: process.env.AJSTUDIOZ_API_KEY,
});