Skip to main content

aiclientjs

The lightweight, universal AI client for JavaScript & TypeScript.

One function. Any model. Zero dependencies.

npm install aiclientjs
import { ai } from 'aiclientjs';

const { text } = await ai('Explain quantum computing in one sentence');

That's it. No boilerplate. No framework lock-in. Works everywhere.

Why aiclientjs?

aiclientjsVercel AI SDKDirect API calls
Bundle size~8 KB gzipped~150 KB+N/A
Dependencies020+varies
ProvidersOpenAI, Anthropic, Google, Ollama, customOpenAI, Anthropic, Google, more1 per SDK
RuntimesNode, Deno, Bun, Browser, EdgePrimarily Node/Edgevaries
Streamingfor await...ofReact hooks / streamsmanual SSE parsing
TypeScriptFirst-class, fully typedYesvaries
Learning curve1 functionFramework conceptsPer-provider docs

Features

  • One unified APIai() works with every provider
  • Zero dependencies — uses native fetch, ReadableStream, TextDecoder
  • Streaming — first-class async iterable support
  • Structured output — type-safe JSON with JSON Schema or Zod
  • Tool calling — define tools, aiclientjs executes them
  • Provider-agnostic — OpenAI, Anthropic, Google Gemini, Ollama, or your own
  • Universal runtime — Node.js 18+, Deno, Bun, Browser, Cloudflare Workers

Runtime Support

RuntimeSupported
Node.js 18+
Deno
Bun
Cloudflare Workers
Browser
Vercel Edge