GPT-4 knows the B4X family of languages.  
After a bit of back and forth, I got it to write B4J code for calling the OpenAI API.
Here is my prompt:
I had to tell it to use the JobDone event and to write it for a B4XPage.  Finally, it produced this:
Sub Class_Globals
    Private Root As...