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#
| Name | Kind | Summary |
|---|---|---|
ready | function | Checks the engine loads and, with model, that the model answers. |
ReadyReport | interface | What ready() found. |
ReadyOptions | interface | Settings 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{}):modelto also call a model once,timeoutMsfor that call,wasmfor 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,archandlibcdescribe this system;errorandcodesay 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.modelnames it,latencyMsis how long the call took;errorandcodesay 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, default30000): 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, aResponse, its bytes, or a compiledWebAssembly.Module).