TypeScript SDK for unified LLM access using OpenAI's format
Top 93.7% on sourcepulse
Token.js provides a unified TypeScript SDK for interacting with over 200 Large Language Models (LLMs) from more than 10 providers, all while adhering to OpenAI's API format. This client-side library simplifies LLM integration for developers by eliminating the need for a proxy server, offering features like tool usage, JSON output, image inputs, and streaming.
How It Works
The SDK leverages OpenAI's established API structure, allowing developers to use a single, consistent interface to call diverse LLM providers. This approach abstracts away the complexities of individual provider APIs, enabling seamless switching and utilization of different models. It operates entirely in the client-side environment, reducing infrastructure overhead and simplifying deployment.
Quick Start & Requirements
npm install token.js
OPENAI_API_KEY
, ANTHROPIC_API_KEY
).Highlighted Details
extendModelList
.Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
Some LLM providers or older models may not support all features like JSON output, function calling, or image inputs, as detailed in the feature compatibility table. Type casting (as any
) is required when using extended models.
3 months ago
1 day