These AI coding agents are as miraculous as they are error-prone, but still worth a try.
convert-units has a simple chained API that is easy to read. It can also be configured with the measures that are packaged with it or custom measures.