One API. Any AI provider.

A provider-agnostic AI runtime for Node.js.
Switch models and providers without changing application code.

index.ts
import { AI } from "anyai";

const ai = new AI({
  provider: "gemini",
  model: "gemini-2.0-flash",
});

const response = await ai.chat.send("Hello!");

Why anyai exists

Infrastructure-grade primitives for working with any AI provider.

Provider-Agnostic

OpenAI, Gemini, Anthropic, Mistral, Ollama. Swap by config, not code.

Capability-First API

chat.send, chat.stream — no provider-specific leakage.

Unified Streaming

One async iterator. Same behavior everywhere.

Minimal Surface Area

Stable types. Strict normalization.

Interactive Playground

Test any provider through the same API.
Change models, keys, and providers in real time.

  • Chat-style interface
  • Provider selector
  • API key management (local-only)
  • Streaming toggle
Providergemini
Modelgemini-2.0-flash
Streaming

> What is the meaning of life?

The meaning of life is a deeply personal question...

How it works

From your code to any provider and back — in five steps.

01

App calls ai.chat.send()

Your application uses the unified API to send a request.

02

anyai normalizes the request

The request is transformed into a provider-neutral format.

03

Adapter routes to provider SDK

The appropriate adapter forwards the call to the target provider.

04

Response normalized back

The provider response is normalized into a consistent shape.

05

Streaming unified if enabled

Async iterators behave identically regardless of provider.

What anyai is — and isn't

Set expectations clearly.

What it is

  • AI runtime infrastructure
  • Adapter-based
  • Config-driven
  • Safe to embed in products

What it is not

  • Not an agent framework
  • Not a prompt library
  • Not a UI SDK
  • Not SaaS

Developer experience

Drop in and start building.

terminal
$ npm install anyai
  • ESM-first
  • Type-safe
  • Tree-shakeable
  • Zero vendor lock-in

Open source

Built in the open. No strings attached.

  • Contributions welcome
  • No tracking, no telemetry
  • No hidden SaaS hooks

Frequently Asked Questions

Everything you need to know about anyai and how it works.

AnyAI offers a unified interface for all major AI providers. Whether you use OpenAI, Anthropic, or Google, you get the exact same error handling, response format, and type safety. No more juggling different SDKs or inconsistent APIs.
Simply install the package using npm/pnpm/yarn, configure your API keys, and start making requests. Our documentation provides copy-paste examples for all common use cases.
The anyai package itself is open source and free. However, you will need your own API keys for the AI providers you choose to use (like OpenAI or Anthropic), which are billed separately by those providers.
Absolutely! AnyAI is built with modern web frameworks in mind. It works seamlessly with Next.js (App Router & Pages Router), Remix, connection-pooling serverless functions, and edge runtimes.

Start experimenting with any provider using one API.