BotConnector

TypeScript streaming

Target SDK design

typescript
import { BotConnectorClient } from "@botconnector/sdk";

const client = new BotConnectorClient();
const model = await client.llm("<publisher>/<model>");
for await (const chunk of model.stream("Explain GGUF")) {
  process.stdout.write(chunk.text);
}
The source SDK is implemented and live-tested, but no npm package is published yet.

Working today via OpenAI-compatible API

This example calls BotConnector Core, the desktop runtime, on its local API at 127.0.0.1:11435 — a preview surface, not the public CLI contract. For the hosted API instead, use https://api.botconnector.id/v1 as shown in the OpenAI-compatible API.

typescript
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "http://127.0.0.1:11435/v1", apiKey: "not-needed" });
const stream = await client.chat.completions.create({
  model: "<publisher>/<model>",
  messages: [{ role: "user", content: "Explain GGUF" }],
  stream: true,
});
for await (const chunk of stream) {
  const delta = chunk.choices[0]?.delta?.content;
  if (delta) process.stdout.write(delta);
}

Wire format: Streaming.