Looking at this tutorial:
http://code.tutsplus.com/tutorials/create-a-custom-keyboard-on-android--cms-22615, it doesn't seem easy or worth the trouble. You'd need to wrap that Java code into a library for B4A such that the B4A class internally extends Android's InputMethodService class. Then you'd need to set your B4A project to run without any activities:
https://www.b4x.com/android/forum/threads/a-service-w-o-any-ui.28543/ . And after all that, you'd still be editing a bunch of .xml files by hand. I think you'd probably be better off just following the tutorial at that link and learning the tiniest bit of Java to get what you need accomplished.
Doing it the Java route seems fairly straightforward, albeit somewhat tedious. The tutorial does most of the work for you and you'd only have to alter some details in the .xml files to fit your purposes. And you only have 8 overridden methods in the Service class whose logic you need to fill out.