Docs

C API

Stable ABI in include/uaii/c_api/uaii.h. Current version is 0.4.0. Package version is 0.3.1.

Rules

BumpWhen
MajorRemoved symbols, layout changes, or new semantics
MinorNew functions or fields appended to a struct. struct_size keeps old callers working
PatchFixes that keep documented behaviour

Gate bindings on uaii_get_c_api_version(). The plugin ABI is separate.

0.4.0 fields

Call uaii_session_options_init, then keep struct_size = sizeof(uaii_session_options). Fields added after max_context:

  • kv_window, kv_sink (default 4)
  • pin_layers, expert_cache_bytes
  • max_threads (0 = hardware concurrency), single_staging

uaii_resolve_memory_preset and uaii_session_options_apply_preset fill those fields. Phone caps at half of free RAM. Laptop, desktop, and server keep their targets when free RAM covers them. See Memory.

Session

uaii_memory_preset_info info;
memset(&info, 0, sizeof info);
info.struct_size = sizeof info;
uaii_resolve_memory_preset("phone", 0, &info);

uaii_session_options opts;
uaii_session_options_init(&opts);
uaii_session_options_apply_preset(&opts, &info);
opts.backend = "auto";

uaii_session* s = NULL;
uaii_session_create("model.q4_k.gguf", &opts, &s);
uaii_session_set_background(s, 1);   /* paused: app backgrounded */
uaii_session_request_cancel(s);      /* cancelled; cleared at generate start */
uaii_session_memory_warning(s);      /* drop KV, keep longrope scale */
uaii_session_destroy(s);

uaii_system_available_bytes and uaii_process_rss_bytes are the counters to log. Weight init stays fail-closed (NONE).