A wrapper around the OpenAI TypeScript library that wraps the Responses API with Pangea AI Guard. Supports Node.js v22 and greater.
npm install @pangeacyber/openaiimport { PangeaOpenAI } from "@pangeacyber/openai";
const client = new PangeaOpenAI({
apiKey: process.env.OPENAI_API_KEY,
pangeaApiKey: process.env.PANGEA_API_KEY,
});
const response = await client.responses.create({
model: "gpt-4o-mini",
instructions: "You are a helpful assistant.",
input: "Are semicolons optional in JavaScript?",
});
console.log(response.output_text);To use this library with Azure OpenAI,
use the PangeaOpenAI class with an Azure base URL.
import { PangeaOpenAI } from "@pangeacyber/openai";
const client = new PangeaOpenAI({
baseURL: "https://YOUR-RESOURCE-NAME.openai.azure.com/openai/v1/",
apiKey: process.env.AZURE_OPENAI_API_KEY,
pangeaApiKey: process.env.PANGEA_API_KEY,
});
const response = await client.responses.create({
model: "gpt-4o-mini",
instructions: "You are a helpful assistant.",
input: "Are semicolons optional in JavaScript?",
});
console.log(response.output_text);