Nyraxis AI

OpenAI

Protect OpenAI API calls with Nyraxis governance policies.

OpenAI Integration

Zero code changes — the SDK patches the OpenAI client automatically.

import nyraxis_sdk
import openai

nyraxis_sdk.init(api_key="nyx_...", enforce=True)

client = openai.OpenAI()
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": user_input}],
)
# Blocked inputs raise NyraxisBlockedError before reaching OpenAI

Manual evaluation

import nyraxis_sdk
import openai

nyraxis_sdk.init(api_key="nyx_...")
client = openai.OpenAI()

# Check input before calling OpenAI
result = nyraxis_sdk.evaluate(input=user_input)
if not result.allowed:
    return f"Blocked: {result.violations[0].description}"

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": user_input}],
)

# Check output after
output_check = nyraxis_sdk.evaluate(output=response.choices[0].message.content)

Node.js

import { NyraxisClient } from "@nyraxis/sdk";
import OpenAI from "openai";

const nyraxis = new NyraxisClient({ apiKey: process.env.NYRAXIS_API_KEY! });
const openai = new OpenAI();

const check = await nyraxis.evaluate({ input: userMessage });
if (!check.allowed) throw new Error("Blocked");

const response = await openai.chat.completions.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: userMessage }],
});

Supported models

All OpenAI models are supported — GPT-4o, GPT-4, GPT-3.5, o1, o3, and custom fine-tunes. Nyraxis evaluates the text, not the model.

On this page