Qubittron Bastion
TypeScript SDK

TypeScript SDK

Official TypeScript SDK for the Bastion sovereign Canadian LLM API. Typed clients for chat, models, images, speech, and transcription.

@qubittron/bastion-sdk is the official TypeScript SDK for Bastion. It wraps the OpenAI-compatible HTTP API with strongly typed resources, async iterables for streaming, and a structured error hierarchy. It runs on Node 20+, Bun, Deno, Cloudflare Workers, Vercel Edge, and modern browsers.

npm install @qubittron/bastion-sdk
import { Bastion } from "@qubittron/bastion-sdk";

const client = new Bastion({ apiKey: process.env.BASTION_API_KEY });

const res = await client.chat.completions.create({
  model: "gpt-oss-120b",
  messages: [{ role: "user", content: "Hello!" }],
});

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

What's in the box

ResourceMethods
client.chat.completionscreate() — sync + streaming chat completions
client.modelslist() — list available models for your account
client.imagesgenerate() — text-to-image generation
client.audiospeech() — TTS via NVIDIA Riva
client.audio.transcriptionscreate() — speech-to-text (Whisper)

All resources return strongly typed responses. Streaming returns an AsyncIterable over typed chunks. Errors throw subclasses of BastionError (AuthenticationError, RateLimitError, UpstreamError, …) so you can branch on instanceof.

Versioning

Pre-1.0 (v0.x) the public surface may change between minors. Pin to a minor for production. The SDK reads BASTION_API_KEY from the environment when no apiKey is passed, so promotion across environments is just an env-var swap.

Source

The SDK lives at packages/sdk in the Bastion monorepo. Issues and feature requests go on the main repo.

On this page