Skip to main content
Boole AI works with the official OpenAI Node.js SDK. Install it from npm, configure the base URL, and every existing chat, streaming, and tool-call pattern works unchanged — no wrapper library, no extra dependencies, no code restructuring required.

Installation

Use process.env.BOOLE_API_KEY to read your API key at runtime — never hardcode it in source files. Set the variable in your shell, a .env file loaded with dotenv, or your deployment platform’s secret manager.

Basic Chat Completion

Instantiate the client with Boole’s baseURL and call chat.completions.create exactly as you would against the OpenAI API.
example.mjs

Streaming

Set stream: true and iterate over the response with for await. Boole begins returning tokens almost immediately at up to 312 tokens/sec on Llama 3.3 70B.
streaming.mjs

TypeScript

The OpenAI SDK ships with full TypeScript definitions. Import ChatCompletionMessageParam and other types directly from the openai/resources sub-path — no extra @types package needed.
example.ts

Local Deployment

When running the Boole local binary, change baseURL to point at localhost. The local server does not validate API keys, so pass any non-empty string.
local.mjs
The local binary cold-starts in under 400 ms and exposes the same /v1 interface as the cloud API. Toggle between environments by changing a single line — the rest of your application code is unchanged.