The library should have a function to set the API mode and not require XCTU (or other serial connection). If, during device.open(), it is found to be in AP0 (transparent) mode, automatically switch the mode so that all other commands work, as expected.