BlazeInferDocs
Integrations

OpenAI TypeScript SDK

Use the official OpenAI TypeScript SDK with BlazeInfer.

SupportedTested with: openai 7.47.0 · Last verified: 2026-11-02

The OpenAI TypeScript SDK works with BlazeInfer by changing the base URL and the key.

Install and configure

npm install openai
export BLAZE_API_KEY="blz_..."
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://blaze.e2enetworks.net/v1",
  apiKey: process.env.BLAZE_API_KEY,
});

const response = await client.chat.completions.create({
  model: "google/gemma-4-31b-it",
  messages: [{ role: "user", content: "Say hello in one sentence." }],
});

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

Save the file as index.mts, or set "type": "module" in package.json, because the examples on this page use top-level await.

Streaming

const stream = await client.chat.completions.create({
  model: "google/gemma-4-31b-it",
  messages: [{ role: "user", content: "Count to five." }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}

Keep the client server-side

Create the client only in server code. A key in a browser bundle is exposed to anyone who opens developer tools.

On this page