TypeScript API: Readiness check

Checks that the engine, keys and providers work before you ship. Generated from the declarations and doc comments of criogenai 0.1.7. See also: TypeScript API overview, the same module in Python.

import { ready, ReadyReport, ReadyOptions } from "criogenai";

Contents#

NameKindSummary
readyfunctionChecks the engine loads and, with model, that the model answers.
ReadyReportinterfaceWhat ready() found.
ReadyOptionsinterfaceSettings for ready().

ready#

function ready(options?: ReadyOptions): Promise<ReadyReport>

Checks the engine loads and, with model, that the model answers.

Use it at start-up or in a health endpoint. It never throws: every problem is in the report. In the browser (criogenai/web) it also loads the WebAssembly engine, so call it once before anything else there.

Parameters

  • options (ReadyOptions, default {}): model to also call a model once, timeoutMs for that call, wasm for the browser engine's location.

Returns: ok and what was checked.

Example

import { ready } from "criogenai";

const report = await ready(); // or ready({ model: "openai:gpt-5-mini" })
console.log(report.ok, report.engine.platform, report.engine.arch);
if (!report.ok) console.error(report.engine.error ?? report.model?.error);

ReadyReport#

interface ReadyReport {
  ok: boolean;
  engine: { ok: boolean; platform: string; arch: string; libc: string | null; error?: string; code?: string };
  model?: { ok: boolean; model: string; latencyMs: number; error?: string; code?: string };
}

What ready() found.

Fields

  • ok (boolean): Everything checked is fine.
  • engine ({ ok: boolean; platform: string; arch: string; libc: string | null; error?: string; code?: string; }): The engine (the native addon, or WebAssembly in a browser): loads here or not. platform, arch and libc describe this system; error and code say why it failed.
  • model ({ ok: boolean; model: string; latencyMs: number; error?: string; code?: string; }, optional): Only when a model was given: its credentials work and it answered. model names it, latencyMs is how long the call took; error and code say why it failed.

ReadyOptions#

interface ReadyOptions {
  model?: Model;
  timeoutMs?: number;
  wasm?: unknown;
}

Settings for ready().

Fields

  • model (Model, optional): Also call this model once with a tiny prompt (spends a few tokens).
  • timeoutMs (number, default 30000): Give up on the model check after this long, in milliseconds.
  • wasm (unknown, optional): Browser only: where the WebAssembly engine is, when it is not next to the script (a URL, a Response, its bytes, or a compiled WebAssembly.Module).