AI API Explorer
What is the AI API Explorer module?
This module provides a number of forms which a site builder can use to test out the results of various API calls, and in some cases obtain boilerplate code to recreate those calls in a module. This module is only intended to be used as part of development: it should only be used to test a given prompt against a selected LLM.
The forms which will appear depend on the specific modules and providers you have configured. Other modules may provide additional forms provided as they require: please see the developers section for more details.
How to use the module
On your site, visit /admin/config/ai/explorers to see which specific explorers you have. Clicking on their menu item will take you to a form which will collect any information required to make your API call: this may include text or file uploads depending on the nature of the API.
The form will show you any configuration options for the provider being used, allowing you to test alternative configuration to find which provides the most suitable results.
When you have entered your data and settings, submitting the form will send your data to the chosen LLM. The response will be shown within the form once the LLM responds. Some forms will also provide code examples along with the LLM response, allowing developers to generate boilerplate code easily.
Run history
Runs and their files are not stored by default. Turn the history on at
/admin/config/ai/explorers/settings to keep each user's runs, with limits on
their number and age. Without it, runs last until the page is left.
Markdown answers in Chat Explorer
Enable Render Markdown in the Chat Explorer's Output tab to format assistant answers with headings, lists, code blocks, tables and strikethrough. Task lists show non-interactive markers for completed and incomplete tasks. The option is off by default and is saved with the chat, including in JSON exports and imports.
Only the displayed assistant answer changes. Copy, export and the history sent to the model retain the original text. User, system and tool messages keep their existing display. Streamed answers use the same formatting once the stream finishes. Raw HTML is stripped by the converter and the resulting HTML is filtered for XSS before display.
Typed decisions
With a Decision provider installed, the Decision Explorer at
/admin/config/ai/explorers/decision_generator lets you experiment with
noul (true/false), choice, score and box questions. It provides a form for state,
questions, up to two optional images and provider selection, shows the
probabilities and prints the equivalent PHP. Its provider and model
selection uses the ai_provider_configuration element: it lists only models
declaring what the parsed request needs, and shows the selected model's
declared features and limits. Incompatible selections and entered criteria are
preserved for correction. Changing the model does not rewrite the request. A
question the model refused is shown as "Refused", next to the other answers.
A box answer shows its edges and confidence, and the box drawn on each image
with its edges in pixels. A box question needs an image. See
Decision calls.
Export and import
Export JSON saves what is in the form, and the download button on a run
saves that run with its answers. Import JSON opens either file again, or
any JSON with state and questions. The format builds on
DecisionInput::toArray():
{
"format": "ai_api_explorer_decision",
"version": 1,
"title": "ticket.subject: Charged twice",
"input": {
"state": {"ticket": {"subject": "Charged twice"}},
"questions": {
"refund_requested": {"type": "noul", "instructions": "Is the customer asking for money back?"}
},
"files": [{"filename": "photo.png", "mime_type": "image/png"}]
},
"settings": {
"provider": {"provider": "openai", "model": "gpt-4.1", "config": {}, "use_default": false}
},
"response": {"model": "gpt-4.1", "usage": {"input": 120, "output": 9, "total": 129}, "answers": {}}
}
inputis whatDecisionInput::toArray()returns: the state as text or an object, and the questions keyed by ID.filesare the reference and target images. The export of a run lists them by name only, and the export of the form leaves them out; addbase64(plain or a data URL) to include an image. Imported images must be PNG, JPEG, GIF or WebP of at most 10 MB, and are named after their content type.settingsandresponseare optional. Import uses the model when "Also use the model saved in the file" is checked, and ignores the answers.