{"_id":"@authensor/connector-openai","name":"@authensor/connector-openai","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@authensor/connector-openai","version":"0.1.0","description":"Authensor safety connector for the OpenAI API — policy evaluation and content scanning on every call","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"dependencies":{"@authensor/engine":"0.1.0"},"optionalDependencies":{"@authensor/aegis":"0.1.0"},"peerDependencies":{"openai":">=4.0.0"},"peerDependenciesMeta":{"openai":{"optional":false}},"devDependencies":{"@types/node":"^20.10.0","openai":"^4.77.0","typescript":"^5.3.0"},"keywords":["authensor","openai","gpt","connector","ai-safety","guardrails","policy-engine"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/authensor/authensor.git","directory":"packages/connector-openai"},"homepage":"https://github.com/authensor/authensor","publishConfig":{"access":"public"},"scripts":{"build":"tsc","dev":"tsc --watch","typecheck":"tsc --noEmit","clean":"rm -rf dist"},"_id":"@authensor/connector-openai@0.1.0","bugs":{"url":"https://github.com/authensor/authensor/issues"},"_integrity":"sha512-9IU7nZrhla1NyzNoSCYbILrmp1iGta1Iz6DqihDKjR/bvopDGXyR18BsQ1vG0oWO+PBOpOnyaNN7qAbn9MUtIg==","_resolved":"/private/var/folders/_h/xdjfwx_n3qxc_plpqltl399m0000gn/T/8981ab971c1f862d40ba1fbeca849816/authensor-connector-openai-0.1.0.tgz","_from":"file:authensor-connector-openai-0.1.0.tgz","_nodeVersion":"20.20.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-9IU7nZrhla1NyzNoSCYbILrmp1iGta1Iz6DqihDKjR/bvopDGXyR18BsQ1vG0oWO+PBOpOnyaNN7qAbn9MUtIg==","shasum":"bc6a2a29336dc40ffa42185b744a5e00648d9f40","tarball":"https://registry.npmjs.org/@authensor/connector-openai/-/connector-openai-0.1.0.tgz","fileCount":15,"unpackedSize":36137,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDFhv6uGC+uPozcZqjTi/K7jUDiOfA6Lt4GdGT2AiSuzAIgFNRLHqg6kSB6hciWQk6jfdIoGjV4TidMyARTHZq9Av4="}]},"_npmUser":{"name":"jkearn","email":"john@authensor.com"},"directories":{},"maintainers":[{"name":"jkearn","email":"john@authensor.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/connector-openai_0.1.0_1781250051949_0.17770417776012382"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-12T07:40:51.769Z","0.1.0":"2026-06-12T07:40:52.078Z","modified":"2026-06-12T07:40:52.405Z"},"maintainers":[{"name":"jkearn","email":"john@authensor.com"}],"description":"Authensor safety connector for the OpenAI API — policy evaluation and content scanning on every call","homepage":"https://github.com/authensor/authensor","keywords":["authensor","openai","gpt","connector","ai-safety","guardrails","policy-engine"],"repository":{"type":"git","url":"git+https://github.com/authensor/authensor.git","directory":"packages/connector-openai"},"bugs":{"url":"https://github.com/authensor/authensor/issues"},"license":"MIT","readme":"# @authensor/connector-openai\n\nSafety connector for the OpenAI API. Wraps the official `openai` SDK so every `chat.completions.create()` call goes through Authensor policy evaluation and Aegis content scanning.\n\n## Quickstart\n\n```bash\nnpm install @authensor/connector-openai openai\n```\n\n```typescript\nimport { createSafeOpenAIClient } from '@authensor/connector-openai';\n\nconst client = await createSafeOpenAIClient({\n  apiKey: process.env.OPENAI_API_KEY,\n  policy: {\n    id: 'my-policy',\n    name: 'My Policy',\n    version: '1.0.0',\n    rules: [\n      { id: 'allow-all', effect: 'allow' },\n    ],\n  },\n});\n\nconst response = await client.chat.completions.create({\n  model: 'gpt-4o',\n  messages: [{ role: 'user', content: 'Hello' }],\n});\n```\n\n## What it does\n\n1. Before each `chat.completions.create()` call, the request content is evaluated against your policy using the Authensor engine.\n2. If the policy says **deny**, an `AuthensorDeniedError` is thrown.\n3. If the policy says **escalate** (`require_approval`), an `AuthensorEscalationError` is thrown.\n4. If the policy says **allow**, the request is forwarded to the OpenAI API.\n5. After receiving a response, Aegis scans the output for threats (PII, injection, credentials, exfiltration).\n6. If Aegis flags the response, an `AuthensorContentThreatError` is thrown.\n\n## Configuration\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `apiKey` | `string` | env var | OpenAI API key |\n| `policy` | `Policy \\| string` | required | Authensor policy object or YAML string |\n| `principalId` | `string` | `'openai-connector'` | ID for audit trail |\n| `aegisEnabled` | `boolean` | `true` | Enable Aegis response scanning |\n| `onEvaluation` | `function` | - | Callback after policy evaluation |\n| `onAegisThreat` | `function` | - | Callback when Aegis flags content |\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-1ad743a6b70ed78ff0b5c6834a392716"}