---
title: "ClikaRt"
sidebar_label: "ClikaRt"
description: "Kotlin binding reference: ClikaRt."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.runtime](../index.md)/[ClikaRt](index.md)

# ClikaRt

[common]\
object [ClikaRt](index.md)

The entry of the binding: the runtime library and the bridge load at the first touch of this object, and [load](load.md) runs the one check every call depends on.

Loading order is the cross-language invariant: the runtime library loads FIRST (through [NativeLibraries](../NativeLibraries/index.md): the `.so` ships in an Android app's `jniLibs`, delivered by the runtime distribution, and on a desktop JVM sits on `java.library.path` or in a bridge jar), then the bridge, which binds to that already-loaded image. [load](load.md) then compares the version the bridge was built for ([builtAgainst](builtAgainst.md)) with the version the loaded library answers ([version](version.md)) and refuses a mismatch before the first call. On Android, load through `ClikaRtAndroid.load(context)` instead, which also places the license credential and the cache root.

Four facts a first program meets. Every call that runs an operator needs the license credential: on a desktop JVM `CLIKA_RT_LICENSE` in the process environment (the `CLIKA1-...` text, or the path of a file holding it) or the per-user file `clikart-license-init` writes; on Android the `license` argument of `ClikaRtAndroid.load`; without one the first operator throws a [ClikaRtException](../ClikaRtException/index.md) whose [ClikaRtException.codeName](../ClikaRtException/codeName.md) is `LICENSE_FAILED`, and the code name, never the message text, is the thing to branch on. Operators are asynchronous: an [Ops](../Ops/index.md) call returns before its work runs, and a read waits for the value ([Tensor.item](../Tensor/item.md), [Tensor.toFloatArray](../Tensor/toFloatArray.md), [Tensor.summary](../Tensor/summary.md), [Tensor.synchronize](../Tensor/synchronize.md)). The CPU worker count, `CLIKA_RT_NUM_THREADS`, is read at the first compute, so it is placed before any tensor exists. This binding is the inference API, not the authoring one: it runs what is ready (an ONNX model or a compiled graph, a tokenizer or a processor, the serving runtime, the readers) and carries a small operator set for an app's own tensors; a model written from the operators (a checkpoint loader, the module tree, a KV cache, the fused attention) is authored in C++ or Python and reaches an app as a served model or a graph. The model library's own loaders (`AutoModel`, `GenerativeModel`, the pipelines, the server) are the `io.clika.modelverse` package of the `clika-modelverse` artifact, which depends on this one and downloads a hub model inside its `fromPretrained`.

```kotlin
ClikaRt.load()
println("ClikaRT ${ClikaRt.version()}")
```

## Properties

| Name | Summary |
|---|---|
| [builtAgainst](builtAgainst.md) | [common]<br>val [builtAgainst](builtAgainst.md): [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)<br>The runtime version this binding was built for; [load](load.md) holds [version](version.md) to it. |
| [isLoaded](isLoaded.md) | [common]<br>val [isLoaded](isLoaded.md): [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)<br>True once [load](load.md) has succeeded in this process. |

## Functions

| Name | Summary |
|---|---|
| [load](load.md) | [common]<br>fun [load](load.md)()<br>Check the loaded runtime library against the version this binding was built for; idempotent. Every other entry of the binding runs it first, so a mismatch surfaces at the first call wherever that is. |
| [synchronizeAll](synchronizeAll.md) | [common]<br>fun [synchronizeAll](synchronizeAll.md)()<br>Wait for every stream in the runtime to finish: the barrier before a host read of a device result, or around a timed phase. |
| [version](version.md) | [common]<br>fun [version](version.md)(): [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)<br>The loaded runtime library's version string (e.g. &quot;0.6.0&quot;). |