How To Call It
AI is a global table: call its functions with a dot (AI.<method>(...)), not a colon.
Sends a prompt to the configured AI provider; returns a table with ok, text, error, errorCode, providerId, providerName and modelId (at most 20 calls per minute).
Documented for app version 1.0.51Updated:
AI is a global table: call its functions with a dot (AI.<method>(...)), not a colon.
Use this to send text or OCR output to the configured cloud provider.
prompt is required. providerId is optional; nil uses app settings. Credentials come from app settings; runtime API key overrides are disabled.
Check ok, text, errorCode and error in the result table. This call does not tap the screen. Visual Decision retries, thresholds and outcome branches require additional Lua logic. Bound request frequency in loops.
The snippet below is a starter pattern that can be applied directly in runtime flow.
-- Uses the provider configured in the app.
local response = AI.ask("Return a short answer")
if response.ok then print(response.text) else print(response.errorCode, response.error) endFrom foundation to combined usage, each level is provided as a separate code block so you can copy the level you need and adapt it directly.
-- Uses the provider configured in the app.
local response = AI.ask("Return a short answer")
if response.ok then print(response.text) else print(response.errorCode, response.error) endlocal stepOk = true
-- Uses the provider configured in the app.
local response = AI.ask("Return a short answer")
if response.ok then print(response.text) else print(response.errorCode, response.error) end
if stepOk then
wait(200)
endlocal ok, err = pcall(function()
-- Uses the provider configured in the app.
local response = AI.ask("Return a short answer")
if response.ok then print(response.text) else print(response.errorCode, response.error) end
end)
if not ok then
print("API step failed: AI.ask: " .. tostring(err))
requestStop()
end-- Use configured credentials and handle failed responses before continuing.
local function run_ask_step()
-- Uses the provider configured in the app.
local response = AI.ask("Return a short answer")
if response.ok then print(response.text) else print(response.errorCode, response.error) end
end
local ok, err = pcall(run_ask_step)
if not ok then
toast("Step failed")
print(err)
end-- Uses the provider configured in the app.
local response = AI.ask("Return a short answer")
if response.ok then print(response.text) else print(response.errorCode, response.error) end