Skip to main content

Gateway

Adaline Gateway is a single SDK to interact with 300+ LLMs. It runs entirely locally — no proxy, no data leaves your environment.

Installation

npm install @adaline/gateway @adaline/types @adaline/openai

Quick Start

import { Gateway } from "@adaline/gateway";
import { OpenAI } from "@adaline/openai";
import { Config, MessageType } from "@adaline/types";

// Initialize gateway and model
const gateway = new Gateway();
const openai = new OpenAI();
const gpt4o = openai.chatModel({ modelName: "gpt-4o", apiKey: process.env.OPENAI_API_KEY });

// Complete a chat
const response = await gateway.completeChat({
  model: gpt4o,
  config: Config().parse({ temperature: 0.7, maxTokens: 300 }),
  messages: [{ role: "user", content: [{ modality: "text", value: "Hello!" }] }],
  tools: [],
});

console.log(response);

Key Features

  • Unified interface — One API for OpenAI, Anthropic, Google, Azure, Bedrock, Groq, Together AI, Open Router, Vertex, XAI, and custom providers
  • Fully local — No proxy server, no data leaves your environment
  • Streaming — First-class async generator support for streaming responses
  • Embeddings — Generate embeddings across providers with a single interface
  • Tool calls — Execute tool calls returned by LLMs
  • Plugins — Pluggable cache, HTTP client, logger, and queue backends
  • Batching & retries — Built-in configurable queues with automatic retry and exponential backoff
  • OpenTelemetry — Native telemetry integration
  • Isomorphic — Works in Node.js and browsers (with dangerouslyAllowBrowser)

Packages

PackageDescription
@adaline/gatewayCore gateway SDK
@adaline/typesShared types for config, messages, tools, etc.
@adaline/openaiOpenAI provider
@adaline/anthropicAnthropic provider
@adaline/googleGoogle provider
@adaline/azureAzure OpenAI provider
@adaline/bedrockAWS Bedrock provider
@adaline/groqGroq provider
@adaline/togetheraiTogether AI provider
@adaline/open-routerOpen Router provider
@adaline/vertexGoogle Vertex provider
@adaline/xaixAI provider

API Reference

Gateway Class

Core class for chat completions, streaming, embeddings, and tool calls.

Types

Config, messages, tools, and response types.

Examples

Practical examples for common use cases.