decideLocal needs more: it
runs on Node.js and takes two more packages.
new Tokz(options)
string
required
Your key,
tokz_live_<id>_<secret>.string
default:"https://api.tokz.dev"
Override for a private endpoint or local development.
function
default:"globalThis.fetch"
Inject your own
fetch for proxies, instrumentation, or tests.tokz.decide(request, options?)
Typed decisions about text with the OpenDecision models. See Decisions API.
no-check
timeout defaults to 60000 ms. decide is never retried, because a retry could bill twice.
tokz.decide(model, inputs, options?)
Calls a fine tune on our servers by name. Needs 0.7+.
no-check
decision. For a multi-label model read selected,
because best names a label even when selected is empty.
tokz.decideLocal(model, inputs, options?)
The same model and the same result shape, run on this machine for free. Needs 0.7+ and two
more packages, about 320 MB on Linux. The flag skips a GPU library it does not use.
no-check
~/.cache/tokz and verifies its hashes. TOKZ_CACHE_DIR
moves the cache. After that it works offline, and asks the server about once an hour whether the
model still exists. See Fine Tune. A bundler cannot see these
two packages, so name them yourself if a tool such as Next’s standalone output copies only what
it traces.
tokz.listDecisionModels(signal?)
The public model catalog, prices and request limits (GET /v1/decide/models). No key
is sent.
tokz.health()
Resolves { ok, latency } and never throws, so it is safe in a readiness probe.