token.js  by token-js

TypeScript SDK for unified LLM access using OpenAI's format

created 1 year ago
281 stars

Top 93.7% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

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

Highlighted Details

  • Supports OpenAI's format for chat completions, including streaming, function calling, JSON mode, and image inputs.
  • Integrates with major providers like OpenAI, Anthropic, AWS Bedrock, Cohere, Gemini, Groq, Mistral, Perplexity, and OpenRouter.
  • Allows extending support for new or custom models via extendModelList.
  • Feature compatibility table clearly outlines supported features per provider.

Maintenance & Community

  • Open source project seeking contributions via its contributing guide.
  • Issues can be reported via the GitHub issues page.

Licensing & Compatibility

  • Licensed under the MIT License.
  • Permissive license suitable for commercial use and integration into closed-source applications.

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.

Health Check
Last commit

3 months ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
5
Star History
55 stars in the last 90 days

Explore Similar Projects

Starred by Tobi Lutke Tobi Lutke(Cofounder of Shopify), Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), and
15 more.

litellm by BerriAI

1.9%
27k
SDK/proxy for calling 100+ LLM APIs using the OpenAI format
created 2 years ago
updated 19 hours ago
Feedback? Help us improve.