The LACT Daemon exposes a JSON API over a unix socket or TCP, available on `/run/lactd.sock` or an arbitrary TCP port. You can configure who has access to the unix socket in `/etc/lact/config.yaml` in the `daemon.admin_group` or `daemon.admin_user` field. The TCP listener is disabled by default for security reasons, see [this README section](../README.md#remote-management) for how to enable it.
The primary API commands for GPU configuration are `get_gpu_config` and `set_gpu_config`. It uses the same configuration format as described in [CONFIG.md](./CONFIG.md), except as JSON instead of YAML.
To change a setting through the API, you should fetch the current config, modify it, and then set it.
Additionally, each config change must be confirmed, or it will be automatically reverted after a short time period (5 seconds by default). This is needed to avoid saving settings that instantly crash a system.
**Deprecated commands**: there is a number of `set_` commands in the API that change individual settings. They are still functional for backwards compatibility purposes, but the `get_gpu_config`/`set_gpu_config` commands should be preferred instead.
Example: how to set the power limit through the API:
For the full list of available commands and responses, you can look at the source code of the schema: [requests](../lact-schema/src/request.rs), [the basic response structure](../lact-schema/src/response.rs) and [all possible types](../lact-schema/src/lib.rs).
{"status":"error","data":"Failed to deserialize request: unknown variant `test`, expected one of `ping`, `list_devices`, `system_info`, `device_info`, `device_stats`, `device_clocks_info`, `set_fan_control`, `set_power_cap`, `set_performance_level`, `set_clocks_value` at line 1 column 18"}
If you want to connect to the socket from a Rust program, you can simply import either the `lact-client` or `lact-schema` (if you want to write a custom client) crates from this repository.