{"_id":"@atom8ai/unify-llm","_rev":"5-c5c7f12cf28d29d87674a72e71c6ab01","name":"@atom8ai/unify-llm","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.1":{"name":"@atom8ai/unify-llm","version":"1.0.1","keywords":["llm","ai","openai","anthropic","claude","gemini","ollama","tool calling","function calling","ai agents","agentic workflows","llm orchestration","llm sdk","api wrapper","typescript api","prompt caching","cost tracking","generative ai","structured outputs","json schema","vercel ai sdk alternative","langchain alternative","unify-llm","multi-llm","ai gateway","llm middleware"],"author":{"name":"Atom8 AI"},"license":"MIT","_id":"@atom8ai/unify-llm@1.0.1","maintainers":[{"name":"atom8ai","email":"atom8.ai@gmail.com"}],"homepage":"https://github.com/Madhan230205/unify-llm#readme","bugs":{"url":"https://github.com/Madhan230205/unify-llm/issues"},"dist":{"shasum":"227d20fd7ff4d4f80ce6e0288ae26fd410821087","tarball":"https://registry.npmjs.org/@atom8ai/unify-llm/-/unify-llm-1.0.1.tgz","fileCount":8,"integrity":"sha512-Opf3wvIKlgrwlLbj/u5LQD3BY8YhXM2YxkVv3SRQBS4yxeUVDr2JFWiPhytdywNcmyt7iTIiBrKw73cbxbaqaQ==","signatures":[{"sig":"MEUCIQDunLGVwOxLGBiqnhCsatp/OGDEfCcLFC9R1/Vp6i4VvwIgMcG7LXSXymbZsQgVWeQmlho3Up/y+lacskUevYqobGY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":385350},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=20.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"9671cf70b0df29156ed608807ff097d57dcb1d56","scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","test:watch":"vitest","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"atom8ai","email":"atom8.ai@gmail.com"},"repository":{"url":"git+https://github.com/Madhan230205/unify-llm.git","type":"git"},"_npmVersion":"10.9.2","description":"The ultimate TypeScript LLM API wrapper and orchestration SDK. Build autonomous AI agents with Universal Tool Calling, Prompt Caching, streaming, and exact cost tracking across OpenAI, Anthropic Claude, Google Gemini, and Ollama. A lightweight, type-safe,","directories":{},"_nodeVersion":"22.17.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","dotenv":"^16.4.5","vitest":"^4.0.18","typescript":"^5.0.0","@types/node":"^20.0.0","@vitest/coverage-v8":"^4.0.18"},"_npmOperationalInternal":{"tmp":"tmp/unify-llm_1.0.1_1773173612681_0.5347862396082173","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@atom8ai/unify-llm","version":"1.0.2","keywords":["llm","ai","openai","anthropic","claude","gemini","ollama","tool calling","function calling","ai agents","agentic workflows","llm orchestration","llm sdk","api wrapper","typescript api","prompt caching","cost tracking","generative ai","structured outputs","json schema","vercel ai sdk alternative","langchain alternative","unify-llm","multi-llm","ai gateway","llm middleware"],"author":{"name":"Atom8 AI"},"license":"MIT","_id":"@atom8ai/unify-llm@1.0.2","maintainers":[{"name":"atom8ai","email":"atom8.ai@gmail.com"}],"homepage":"https://github.com/Madhan230205/unify-llm#readme","bugs":{"url":"https://github.com/Madhan230205/unify-llm/issues"},"dist":{"shasum":"a95c0f4a1806cb3995f782fe6dbb2fd86fe3a4d3","tarball":"https://registry.npmjs.org/@atom8ai/unify-llm/-/unify-llm-1.0.2.tgz","fileCount":9,"integrity":"sha512-ERMmrI0sN7GeGYqmzqnBOIuDSSyHHLQuF8gVV7ak9XjRCDZ7dzqsqUro+H6y8Icpcydfh8CPzmxYJlOMFznSKQ==","signatures":[{"sig":"MEYCIQCRD/pgYEjbvNN2gJOPtr8CICOVKJtvkzeniDV1OZd5oAIhALvMERZFjnQKW7+h1+Z3m5AZFmqIfsziu2mHwuvUSu26","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1727294},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=20.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"7a2974d15eefd61332db46b39933a5d0d48201c7","scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","benchmark":"tsx benchmarks/run.ts","test:watch":"vitest","benchmark:ci":"tsx benchmarks/run.ts --iterations 80 --batch-size 20 --out benchmarks/latest.json && tsx benchmarks/assert.ts benchmarks/latest.json","test:coverage":"vitest run --coverage","benchmark:quick":"tsx benchmarks/run.ts --iterations 80 --batch-size 20","benchmark:gemini":"tsx benchmarks/gemini-truthfulness.ts","benchmark:truthfulqa":"tsx benchmarks/truthfulqa.ts","benchmark:validation":"tsx benchmarks/validation.ts","test:gemini:realtime":"node ./scripts/run-gemini-realtime-test.mjs","benchmark:comprehensive":"tsx benchmarks/comprehensive-validation.ts"},"_npmUser":{"name":"atom8ai","email":"atom8.ai@gmail.com"},"repository":{"url":"git+https://github.com/Madhan230205/unify-llm.git","type":"git"},"_npmVersion":"10.9.2","description":"A TypeScript SDK for multi-provider LLM orchestration with tool calling, prompt caching, streaming, routing, and cost tracking across OpenAI, Anthropic, Gemini, and Ollama.","directories":{},"_nodeVersion":"22.17.0","dependencies":{"@google/generative-ai":"^0.12.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","tsup":"^8.0.0","dotenv":"^16.4.5","vitest":"^4.0.18","typescript":"^5.0.0","@types/node":"^20.0.0","@vitest/coverage-v8":"^4.0.18"},"_npmOperationalInternal":{"tmp":"tmp/unify-llm_1.0.2_1773410661438_0.9896369842499262","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@atom8ai/unify-llm","version":"1.0.3","description":"A TypeScript SDK for multi-provider LLM orchestration with tool calling, prompt caching, streaming, routing, and cost tracking across OpenAI, Anthropic, Gemini, and Ollama.","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"build":"tsup","dev":"tsup --watch","benchmark":"tsx benchmarks/run.ts","benchmark:truthfulqa":"tsx benchmarks/truthfulqa.ts","benchmark:gemini":"tsx benchmarks/gemini-truthfulness.ts","benchmark:validation":"tsx benchmarks/validation.ts","benchmark:comprehensive":"tsx benchmarks/comprehensive-validation.ts","benchmark:quick":"tsx benchmarks/run.ts --iterations 80 --batch-size 20","benchmark:ci":"tsx benchmarks/run.ts --iterations 80 --batch-size 20 --out benchmarks/latest.json && tsx benchmarks/assert.ts benchmarks/latest.json","test":"vitest run","test:gemini:realtime":"node ./scripts/run-gemini-realtime-test.mjs","test:watch":"vitest","test:coverage":"vitest run --coverage"},"homepage":"https://github.com/Madhan230205/unify-llm#readme","repository":{"type":"git","url":"git+https://github.com/Madhan230205/unify-llm.git"},"engines":{"node":">=20.0.0"},"bugs":{"url":"https://github.com/Madhan230205/unify-llm/issues"},"keywords":["llm","ai","openai","anthropic","claude","gemini","ollama","tool calling","function calling","ai agents","agentic workflows","llm orchestration","llm sdk","api wrapper","typescript api","prompt caching","cost tracking","generative ai","structured outputs","json schema","vercel ai sdk alternative","langchain alternative","unify-llm","multi-llm","ai gateway","llm middleware"],"author":{"name":"Atom8 AI"},"license":"MIT","dependencies":{"@google/generative-ai":"^0.12.0"},"devDependencies":{"@types/node":"^20.0.0","@vitest/coverage-v8":"^4.0.18","dotenv":"^16.4.5","tsup":"^8.0.0","tsx":"^4.21.0","typescript":"^5.0.0","vitest":"^4.0.18"},"_id":"@atom8ai/unify-llm@1.0.3","gitHead":"3a0ef4dcba7f9f51c60fc48be51a9683919fdc76","_nodeVersion":"22.17.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-3kClRCyR+LsGOjX6jWM8gmSu4BfsxmbFjPjHu0ICwVpfHKXCRSzrzWlyttu/txqmM29sAq0cD6KUs/rapV6RVQ==","shasum":"179d79cc7c7df5b074e27293be6efce89f916b77","tarball":"https://registry.npmjs.org/@atom8ai/unify-llm/-/unify-llm-1.0.3.tgz","fileCount":9,"unpackedSize":1717526,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDPBr8nwIh2p2qxcsvBjhBMWEYnufOQra+vE7eqmMoPQAIhAIjkpsiY8pMRq2gN28Wi6uhY4K5XyJk7y2IFTTePe2Ym"}]},"_npmUser":{"name":"atom8ai","email":"atom8.ai@gmail.com"},"directories":{},"maintainers":[{"name":"atom8ai","email":"atom8.ai@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/unify-llm_1.0.3_1773414853629_0.26501773795907035"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-10T17:37:57.821Z","modified":"2026-03-13T15:14:13.959Z","1.0.0":"2026-03-10T17:37:58.063Z","1.0.1":"2026-03-10T20:13:32.829Z","1.0.2":"2026-03-13T14:04:21.606Z","1.0.3":"2026-03-13T15:14:13.815Z"},"bugs":{"url":"https://github.com/Madhan230205/unify-llm/issues"},"author":{"name":"Atom8 AI"},"license":"MIT","homepage":"https://github.com/Madhan230205/unify-llm#readme","keywords":["llm","ai","openai","anthropic","claude","gemini","ollama","tool calling","function calling","ai agents","agentic workflows","llm orchestration","llm sdk","api wrapper","typescript api","prompt caching","cost tracking","generative ai","structured outputs","json schema","vercel ai sdk alternative","langchain alternative","unify-llm","multi-llm","ai gateway","llm middleware"],"repository":{"type":"git","url":"git+https://github.com/Madhan230205/unify-llm.git"},"description":"A TypeScript SDK for multi-provider LLM orchestration with tool calling, prompt caching, streaming, routing, and cost tracking across OpenAI, Anthropic, Gemini, and Ollama.","maintainers":[{"name":"atom8ai","email":"atom8.ai@gmail.com"}],"readme":"# Unify LLM: TypeScript SDK for Multi-Provider LLM Orchestration\r\n\r\n**Unify LLM is a TypeScript SDK for building AI applications across OpenAI, Anthropic, Gemini, and Ollama with one consistent API.** Use it when you need provider-agnostic text generation, tool calling, structured outputs, prompt caching, streaming, middleware, cost tracking, routing, and hallucination interception without rewriting your app for every model vendor.\r\n\r\n[![npm version](https://img.shields.io/npm/v/@atom8ai/unify-llm.svg?style=flat-square)](https://www.npmjs.com/package/@atom8ai/unify-llm)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)\r\n[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg?style=flat-square)](https://www.typescriptlang.org/)\r\n[![CI](https://img.shields.io/github/actions/workflow/status/Madhan230205/unify-llm/ci.yml?branch=main&style=flat-square)](https://github.com/Madhan230205/unify-llm/actions/workflows/ci.yml)\r\n\r\nUnify LLM is designed for developers who want a **TypeScript-first LLM SDK** with direct control over providers, middleware, and runtime behavior. It normalizes provider differences such as OpenAI `tool_calls`, Anthropic `tool_use`, and Gemini `functionCall`, while still leaving room for provider-specific options when you need them.\r\n\r\n## Table of contents\r\n\r\n- [Why use Unify LLM?](#why-use-unify-llm)\r\n- [Core features](#core-features)\r\n- [Installation](#installation)\r\n- [Quickstart](#quickstart)\r\n- [Tool calling example](#tool-calling-example)\r\n- [Middleware, routing, and safety](#middleware-routing-and-safety)\r\n- [Supported providers](#supported-providers)\r\n- [Benchmarks and quality signals](#benchmarks-and-quality-signals)\r\n- [Use cases](#use-cases)\r\n- [Unify LLM vs other TypeScript AI SDKs](#unify-llm-vs-other-typescript-ai-sdks)\r\n- [Plain-English naming guide](#plain-english-naming-guide)\r\n- [Examples and repository guide](#examples-and-repository-guide)\r\n- [FAQ](#faq)\r\n- [Contributing](#contributing)\r\n- [License](#license)\r\n\r\n## Why use Unify LLM?\r\n\r\nMost multi-provider AI projects hit the same friction points:\r\n\r\n- different request and response shapes for each provider\r\n- inconsistent tool calling formats\r\n- one-off streaming adapters scattered across the codebase\r\n- duplicate cost tracking and retry logic\r\n- growing need for routing, safety, and local-model support\r\n\r\nUnify LLM gives you a single client and middleware pipeline so your application logic stays stable while you switch models, add failover, or experiment with routing.\r\n\r\n### Best fit for\r\n\r\n- **TypeScript AI apps** that need OpenAI, Anthropic, Gemini, and Ollama behind one SDK\r\n- **AI agents** that rely on tool calling and structured outputs\r\n- **LLM gateways** that need retries, rate limiting, routing, or cost controls\r\n- **safety-aware systems** that want response anomaly detection or stream interception\r\n- **teams comparing providers** without rewriting business logic for each API\r\n\r\n## Core features\r\n\r\n- **Unified multi-provider API** for OpenAI, Anthropic, Gemini, Ollama, and related integrations\r\n- **Universal tool calling** with a single schema shape across supported providers\r\n- **Structured outputs** using JSON schema-style contracts\r\n- **Streaming support** for incremental generation and stream middleware\r\n- **Prompt caching support** where providers expose native caching controls\r\n- **Middleware pipeline** for retry, caching, rate limiting, cost tracking, and safety\r\n- **Routing primitives** for cost/latency/quality-aware or drift-aware model selection\r\n- **Hallucination interception** for response anomaly detection and early stream aborts\r\n- **TypeScript-first developer experience** with exported types, examples, and benchmark utilities\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @atom8ai/unify-llm\r\n```\r\n\r\nRequires **Node.js 20+**.\r\n\r\nIf you want to run examples locally, configure the provider API keys you actually use. For local-only workflows with Ollama, point your runtime at `http://localhost:11434`.\r\n\r\n## Quickstart\r\n\r\nThis is the fastest way to send one prompt through a unified TypeScript interface.\r\n\r\n```ts\r\nimport { UnifyClient, OpenAIProvider } from '@atom8ai/unify-llm';\r\n\r\nconst client = new UnifyClient()\r\n  .registerProvider(new OpenAIProvider(process.env.OPENAI_API_KEY!));\r\n\r\nconst response = await client.generate('openai', {\r\n  model: 'gpt-4o',\r\n  messages: [\r\n    { role: 'user', content: 'Explain prompt caching in one sentence.' },\r\n  ],\r\n});\r\n\r\nconsole.log(response.content);\r\n```\r\n\r\nIf you later switch from OpenAI to Anthropic or Gemini, your app can keep the same high-level flow while only changing provider registration and model selection.\r\n\r\n## Tool calling example\r\n\r\nUnify LLM is especially useful when you want one tool definition that works across multiple LLM providers.\r\n\r\n```ts\r\nimport { UnifyClient, OpenAIProvider } from '@atom8ai/unify-llm';\r\n\r\nconst client = new UnifyClient()\r\n  .registerProvider(new OpenAIProvider(process.env.OPENAI_API_KEY!));\r\n\r\nconst getWeatherTool = {\r\n  name: 'getWeather',\r\n  description: 'Get the current weather for a city.',\r\n  schema: {\r\n    type: 'object',\r\n    properties: {\r\n      city: { type: 'string' },\r\n    },\r\n    required: ['city'],\r\n  },\r\n  execute: async ({ city }: { city: string }) => {\r\n    return { city, forecast: 'Rain', temperatureF: 52 };\r\n  },\r\n};\r\n\r\nconst result = await client.generate('openai', {\r\n  model: 'gpt-4o',\r\n  messages: [\r\n    { role: 'user', content: 'Should I bring an umbrella in Seattle today?' },\r\n  ],\r\n  tools: [getWeatherTool],\r\n  autoExecute: true,\r\n});\r\n\r\nconsole.log(result.content);\r\n```\r\n\r\n## Middleware, routing, and safety\r\n\r\nThe middleware layer is where Unify LLM becomes more than a thin API wrapper.\r\n\r\n```ts\r\nimport {\r\n  CacheMiddleware,\r\n  CostTrackerMiddleware,\r\n  RetryMiddleware,\r\n  UnifyClient,\r\n  OpenAIProvider,\r\n  createHallucinationGuard,\r\n} from '@atom8ai/unify-llm';\r\n\r\nconst costTracker = new CostTrackerMiddleware();\r\n\r\nconst client = new UnifyClient()\r\n  .registerProvider(new OpenAIProvider(process.env.OPENAI_API_KEY!))\r\n  .use(new CacheMiddleware())\r\n  .use(new RetryMiddleware({ maxRetries: 3, baseDelayMs: 1000 }))\r\n  .use(costTracker)\r\n  .use(createHallucinationGuard({ alpha: 1.2, tau: 2, chunkSize: 6 }));\r\n\r\nconst response = await client.generate('openai', {\r\n  model: 'gpt-4o-mini',\r\n  messages: [{ role: 'user', content: 'Summarize the benefits of JSON schema.' }],\r\n});\r\n\r\nconsole.log(response.content);\r\nconsole.log('Total cost:', costTracker.getTotalCost());\r\n```\r\n\r\n### Routing and orchestration highlights\r\n\r\nUnify LLM includes advanced and experimental routing primitives for teams exploring:\r\n\r\n- **cost/latency/quality tradeoffs** with `CostLatencyQualityRouter`\r\n- **Gaussian-process utility routing** with `BayesianUtilityRouter`\r\n- **topological drift monitoring** with `TopologicalDriftRouter`\r\n- **complexity-threshold routing** with `ComplexityThresholdRouter`\r\n- **failover-capable orchestration** with `SelfHealingGateway`\r\n\r\nThese are useful when you want a single TypeScript SDK to act like a lightweight **LLM gateway**, **multi-model router**, or **AI orchestration layer**.\r\n\r\n## Supported providers\r\n\r\n| Provider | Typical models | Tool calling | Streaming | Vision | Prompt caching |\r\n| --- | --- | --- | --- | --- | --- |\r\n| OpenAI | `gpt-4o`, `gpt-4o-mini`, `o1` | ✅ | ✅ | ✅ | N/A |\r\n| Anthropic | `claude-3-7-sonnet`, `claude-3-opus` | ✅ | ✅ | ✅ | ✅ |\r\n| Google Gemini | `gemini-2.0-flash`, `gemini-1.5-pro` | ✅ | ✅ | ✅ | ✅ |\r\n| Ollama | `llama3.3`, `mistral`, `phi4` | ✅ | ✅ | ✅ | N/A |\r\n\r\n## Benchmarks and quality signals\r\n\r\nUnify LLM ships with a reproducible benchmark harness in `benchmarks/run.ts` and evaluation helpers in `evaluation/`.\r\n\r\n### What the benchmark covers\r\n\r\n- hallucination guard accuracy\r\n- stream abort latency\r\n- cost savings from model routing\r\n- scaling behavior for micro-batched async workloads\r\n\r\n### Current checked-in synthetic snapshot\r\n\r\nFrom the current local benchmark artifact in `benchmarks/latest.json`:\r\n\r\n- **hallucination guard accuracy:** `100%`\r\n- **guardian p95 abort latency:** `19.23 ms`\r\n- **cost savings vs always-frontier baseline:** `43.69%`\r\n- **scaling smoke test:** `10,000` micro-batched iterations completed\r\n\r\n### CI regression thresholds\r\n\r\nThe benchmark assertion step currently enforces these regression guards:\r\n\r\n- guardian accuracy **≥ 95%**\r\n- guardian p95 abort latency **≤ 50 ms**\r\n- pareto cost savings **≥ 20%**\r\n\r\nThese are **synthetic benchmark thresholds**, not universal production guarantees. They are most useful for catching regressions in routing and safety logic over time.\r\n\r\n### Test coverage signal\r\n\r\nThe latest local test run completed with **33 passing test files**, **230 passing tests**, and **1 skipped file**, which helps keep README claims grounded in code that is actually exercised.\r\n\r\n## Use cases\r\n\r\nDevelopers usually land on Unify LLM through one of these intents:\r\n\r\n### Build one app across multiple LLM providers\r\n\r\nUse one TypeScript client to talk to OpenAI, Anthropic, Gemini, and Ollama while keeping your application code stable.\r\n\r\n### Add tool calling to AI agents\r\n\r\nDefine tools once, keep schemas predictable, and avoid provider-specific tool payload drift.\r\n\r\n### Create a lightweight TypeScript LLM gateway\r\n\r\nCombine middleware, routing, and failover so your app can make model decisions without adopting a heavier agent framework.\r\n\r\n### Add safety checks to streaming AI output\r\n\r\nUse `createHallucinationGuard` to monitor semantic drift, annotate provider metadata, and stop unstable streams early.\r\n\r\n### Run local and hosted models side by side\r\n\r\nUse Ollama for local experimentation and hosted providers for production paths or fallbacks.\r\n\r\n## Unify LLM vs other TypeScript AI SDKs\r\n\r\nThis section exists for real developer intent: many users are actively searching for a **Vercel AI SDK alternative**, **LangChain.js alternative**, or a more focused **multi-provider LLM SDK for TypeScript**.\r\n\r\n| Tool | Best when you want | Tradeoff |\r\n| --- | --- | --- |\r\n| **Unify LLM** | One API for multiple providers, middleware, routing, tool calling, and safety primitives | Smaller ecosystem than the largest framework players |\r\n| **Vercel AI SDK** | Tight UI integration for web apps, especially React/Next.js streaming experiences | Less centered on experimental routing and safety middleware primitives |\r\n| **LangChain.js** | Large ecosystem of chains, integrations, and agent abstractions | Heavier abstraction layer if you mainly want direct provider control |\r\n\r\n### When Unify LLM is a strong choice\r\n\r\n- you want a **TypeScript SDK for OpenAI, Anthropic, Gemini, and Ollama**\r\n- you care about **middleware**, **tool calling**, and **provider normalization**\r\n- you want **routing** and **safety controls** without building them all from scratch\r\n- you prefer direct programmatic control over a large framework stack\r\n\r\n## Plain-English naming guide\r\n\r\nSome modules still keep research-style or legacy names for backward compatibility. For new code, prefer the clearer aliases below.\r\n\r\n| Internal name | Preferred public name | Meaning |\r\n| --- | --- | --- |\r\n| `createSemanticMomentumGuardian` | `createHallucinationGuard` | Hallucination and drift guard |\r\n| `HallucinationInterceptionAlgorithm` | `ResponseAnomalyDetector` | Response anomaly detector |\r\n| `ParetoNavigatorRouter` | `CostLatencyQualityRouter` | Cost/latency/quality router |\r\n| `PrimRouter` | `TopologicalDriftRouter` | Topological drift router |\r\n| `VonNeumannRouter` | `BayesianUtilityRouter` | Bayesian utility router |\r\n| `AstralDysonRouter` | `ComplexityThresholdRouter` | Prompt complexity router |\r\n| `semanticFingerprintEngine.ts` | `semanticFingerprint.ts` | Semantic fingerprint helpers |\r\n| `topologyPersistence.ts` | `topologyDrift.ts` | Topology drift helpers |\r\n| `loopRiskEngine.ts` | `executionLoopRisk.ts` | Execution loop risk helpers |\r\n\r\n## Examples and repository guide\r\n\r\nUseful starting points in this repository:\r\n\r\n- [`examples/basic.ts`](./examples/basic.ts) - base client with cache and cost tracking\r\n- [`examples/orchestration.ts`](./examples/orchestration.ts) - retrieval, prompt templates, and structured parsing\r\n- [`examples/paretoNavigator.ts`](./examples/paretoNavigator.ts) - multi-objective routing example\r\n- [`examples/primRouter.ts`](./examples/primRouter.ts) - topological drift routing example\r\n- [`examples/hallucinationGuard.ts`](./examples/hallucinationGuard.ts) - non-streaming and streaming guard usage\r\n- [`benchmarks/run.ts`](./benchmarks/run.ts) - local benchmark harness\r\n- [`CONTRIBUTING.md`](./CONTRIBUTING.md) - contributor setup and expectations\r\n\r\n## FAQ\r\n\r\n### What is Unify LLM in one sentence?\r\n\r\nUnify LLM is a TypeScript SDK that lets you build AI applications across multiple LLM providers with one API for generation, tool calling, middleware, routing, and safety.\r\n\r\n### Is Unify LLM a LangChain.js replacement?\r\n\r\nIt can be, depending on your goals. If you want a lighter TypeScript abstraction with direct provider control, middleware, and routing primitives, Unify LLM is a strong option.\r\n\r\n### Is Unify LLM a Vercel AI SDK alternative?\r\n\r\nYes. If your priority is provider normalization, routing, and middleware rather than UI-focused web framework helpers, Unify LLM is a reasonable alternative.\r\n\r\n### Can I use local models?\r\n\r\nYes. Unify LLM includes an `OllamaProvider`, which is useful for local inference, offline experiments, and hybrid local/hosted setups.\r\n\r\n### Does Unify LLM support structured outputs?\r\n\r\nYes. You can define JSON schema-style response shapes and use them for more predictable parsing and downstream automation.\r\n\r\n### Does Unify LLM include hallucination protection?\r\n\r\nIt includes `createHallucinationGuard`, which monitors semantic drift and can annotate or abort unstable response streams. You should still add normal application-level validation and domain-specific safety checks in production.\r\n\r\n## Contributing\r\n\r\nContributions are welcome.\r\n\r\n- Open an issue for bugs, provider support requests, or documentation gaps\r\n- Include tests when you change routing, middleware, or core request handling\r\n- Include benchmark notes when your change affects performance, safety, or routing behavior\r\n- Start with [`CONTRIBUTING.md`](./CONTRIBUTING.md)\r\n\r\n## License\r\n\r\nReleased under the [MIT License](./LICENSE).\r\n","readmeFilename":"README.md"}