Skip to content

About

Official TypeScript & JavaScript Client SDK for SentioGate AI Router

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

SentioGate JavaScript / TypeScript SDK (@sentiogate/sdk)

npm version License: Apache-2.0 Website Live Benchmarks

Lightweight, zero-dependency client SDK for SentioGate — the zero-markup, OpenAI-compatible LLM router that sends each request to a suitable model across your own provider keys (OpenAI, Anthropic, Gemini, DeepSeek, Groq and more) and automatically falls back to another model if one fails.


⚡ Installation

# npm
npm install @sentiogate/sdk

# pnpm
pnpm add @sentiogate/sdk

# yarn
yarn add @sentiogate/sdk

# bun
bun add @sentiogate/sdk

🚀 Quickstart

import { AutoRouter } from "@sentiogate/sdk";

const router = new AutoRouter({
  baseUrl: "https://api.sentiogate.dev", // host only; the SDK adds /v1/...
  apiKey: process.env.SENTIOGATE_API_KEY,
});

// Basic chat completion: "auto" picks the cheapest suitable model
const response = await router.chat({
  model: "auto",
  messages: [
    { role: "system", content: "You are a concise engineering assistant." },
    { role: "user", content: "Explain vector embeddings in 1 sentence." },
  ],
});

console.log(response.choices[0].message.content);

🌊 Streaming Completions

for await (const chunk of router.streamChat({
  model: "auto",
  messages: [{ role: "user", content: "Write a quicksort implementation in TypeScript." }],
  extraBody: { route_preference: "latency" }, // "cost" (default), "quality" or "latency"
})) {
  process.stdout.write(chunk.choices?.[0]?.delta?.content || "");
}

🛠️ Key Capabilities

  • 0% Token Markup: Bring-Your-Own-Key (BYOK). You pay your providers directly; SentioGate adds no fee per token.
  • Automatic routing: send model: "auto" and set route_preference (via extraBody) to cost (default), quality or latency. You can also request a specific provider/model.
  • Fallback: SentioGate automatically falls back to another model if one fails.
  • Structured errors and opt-in retries: RouterClientError exposes code, retryAfter and retryable; set maxRetries to retry transient 429s after the server's Retry-After.
  • OpenAI-compatible: pass extra OpenAI-style parameters through extraBody.
  • Multi-Environment Support: Node.js 18+, Bun, Deno, edge runtimes and modern browsers.

🔗 Useful Links

About

Official TypeScript & JavaScript Client SDK for SentioGate AI Router

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages