ai_inspector
AI Inspector is a monitoring and observability dashboard for the Drupal AI layer. It captures every AI request the AI module makes — prompt, response, tokens, timing, cost and status — and surfaces it as a developer-focused dashboard. Secrets are masked at capture.
Features
- Request & response inspector — full prompt, raw + processed response, finish reason, tokens, errors/warnings, per user.
- Token dashboard — prompt/completion/total tokens, estimated cost from an editable per-model price table, daily usage.
- Performance dashboard — response time, average latency, failed requests, success rate, with daily/provider/model charts.
- Provider health — response time, token volume and error rate per configured provider.
- Vector database inspector (submodule) — collections, embedding binding, index, collection health and a similarity tester over Search API ai_search indexes.
- CSV/JSON export (submodule) — permission-gated, masked.
- Captures AI calls from any module or code path that uses the AI layer, including decoupled REST/JS clients. No changes to calling code required.
- Secrets masked at capture; capture is asynchronous via the Queue API (no added request latency); dashboards read a daily rollup, not raw rows.
Post-Installation
Enable the module (and optionally ai_inspector_vector / ai_inspector_export), then visit Configuration → AI → AI Inspector (/admin/config/ai/inspector/requests). Configure capture, retention, masking and the cost price table under the Settings tab. Grant the "Access AI Inspector", "View AI request logs" and "Administer AI Inspector" permissions as appropriate. Capture begins automatically for any call made through drupal/ai.
Additional Requirements
Requires drupal/ai with at least one configured AI provider (e.g. OpenAI, AWS Bedrock, Ollama). The Vector submodule additionally requires drupal/search_api and an ai_search server/index. No external services beyond your configured AI provider.
Recommended modules/libraries
- AI (drupal/ai) — required; the layer this module observes.
- AI Search (drupal/ai_search) + Search API — to use the Vector inspector submodule.