Skip to main content

Getting Started

ModelFusion is a TypeScript library for building AI applications, chatbots, and agents.

  • Vendor-neutral: ModelFusion is a non-commercial open source project that is community-driven. You can use it with any supported provider.
  • Multi-modal: ModelFusion supports a wide range of models including text generation, image generation, vision, text-to-speech, speech-to-text, and embedding models.
  • Streaming: ModelFusion supports streaming for many generation models, e.g. text streaming, structure streaming, and full duplex speech streaming.
  • Utility functions: ModelFusion provides functionality for tools and tool usage, vector indices, and guards functions.
  • Type inference and validation: ModelFusion infers TypeScript types wherever possible and to validates model responses.
  • Observability and logging: ModelFusion provides an observer framework and out-of-the-box logging support.
  • Resilience and Robustness: ModelFusion ensures seamless operation through automatic retries, throttling, and error handling mechanisms.
  • Server: ModelFusion provides a Fastify plugin that exposes a ModelFusion flow as a REST endpoint that uses server-sent events.



ModelFusion is in its initial development phase. The main API is now mostly stable, but until version 1.0 there may be breaking changes. Feedback and suggestions are welcome.

npm install modelfusion

Or use a template:

API Keys

You can provide API keys for the different providers using environment variables (e.g., OPENAI_API_KEY) or by passing them in as options to the model constructors.


  • Node.js version 18 or above. ModelFusion uses the Node.js fetch API and parts of the Web Streams API, which were not enabled by default before Node 18.

Getting Support