C API
A stable ABI for language bindings and embedding. The header is include/uaii/c_api/uaii.h, and the current version is 0.3.0, ahead of 1.0.
Versioning
- MAJOR
- Removed symbols, layout changes, or altered semantics
- MINOR
- Backward-compatible additions, where fields are appended and
struct_sizeis honoured - PATCH
- Fixes that preserve documented behaviour
Gate your bindings on uaii_get_c_api_version(). The plugin ABI, UAII_PLUGIN_ABI_VERSION, is versioned independently.
Session options
Always call uaii_session_options_init, then set struct_size = sizeof(uaii_session_options). The fields that matter most in 0.3.0:
backend, which defaults to"cpu"; pass"auto"to run the same GPU probe as the CLI. Alsoweights_dirandweight_init, which defaults to NONEenable_fusion,enable_memory_reuse,enable_streaming,enable_profilercompute_dtype,keep_quantized_weights, andmax_context, the generation bound, where 0 reads the limit from graph metadata
Not on this ABI yet
The sliding KV window (kv_window) and the laptop memory preset live on the CLI and C++ SessionOptions. A C session therefore runs without the 2048-token window until a later struct_size revision adds the field.
Core calls
uaii_session_options opts;
uaii_session_options_init(&opts);
opts.struct_size = sizeof(opts);
opts.enable_profiler = 1;
opts.profile_trace_path = "trace.json";
uaii_session* s = NULL;
uaii_session_create("model.uaii.json", &opts, &s);
float x[] = {1, 2, 3, 4};
uaii_session_set_f32(s, "x", x, 4);
uaii_session_run(s);
/* Optional: uaii_session_generate(...) for token generation */
uaii_session_destroy(s);The shared library builds from the CMake target uaii_capi. The full stability policy is in docs/c_api_stability.md in the repository.