Some time ago I introduced uapi, the control plane API I build primarily for use with Terraform.
Recently I released v4, which targets next OpenWrt major release. It is already working with current snapshot. This also means that it won't work on OpenWrt 25.12, which should use uapi 3.x.
Since my last post, in addition to the Terraform provider, I introduced a new way to consume uapi: uapi-mcp, which let your AI agent configure your router through the MCP protocol .
Finally I'm happy to announce that uapi 4.0.1 will be the first version to be added in the official OpenWrt packages repository. The PR is very close to be merged.
Thanks! There is no example in the repo yet. This is designed so one declared provider manages one device. I guess you mean a case like a gateway plus a few APs with the same Wi-Fi, or a fleet of similar routers.
The pattern I would start with: a module that holds the shared config, with variables for what differs per device (hostname, addresses, channel), called once per device with its own provider instance and its own token.
If you want all devices in one configuration, it looks like this:
Personally, I use one workspace per device instead: the same code, with the endpoint and the token of the device set as variables of its workspace in OTF. I do not need to deploy a config to thousands of devices, so I apply the workspaces one after the other.
Since 4.0, I received a feature contribution, and I made a few changes of my own. They are all merged, and they will ship as 4.1.0 at the start of December:
dhcp/domains models the local DNS records of dnsmasq, the Hostnames tab of LuCI.
When a package install or removal fails, the response gives the output of apk.
The diagnostics of uapi keep the cause of a failed reload.
The output of commands and the messages of interpreter errors stay out of syslog and the diagnostics, because they can quote config values.
uapi keeps only the end of a command output, so a noisy package script cannot fill the memory of the router.
A minor every month
From 4.1.0, a new minor ships on the first Monday of each month, when there is something new in it. A fix does not wait for it: it ships as a patch when it is ready.
The release branches of OpenWrt take only bug and security fixes. So the minor of uapi that the package feed carries when OpenWrt cuts its branch is the one that this release ships. I will keep that minor on its own branch, with bug and security fixes, for as long as OpenWrt supports the release.
Call for contributions
A feature that you want in the next OpenWrt release must be in a minor before OpenWrt cuts its branch. I do not know that date yet. I will post it here when I know it. Until then, each monthly minor can take your feature.
If something that you need is missing, open an issue or a PR. For example:
a resource that uapi does not model yet, or an option that a resource does not cover.
a configuration that OpenWrt ships and that uapi refuses. This is still the error class I care about most.
docs/adding-a-resource.md tells how to add a resource, and CONTRIBUTING.md gives the rules for a PR.