Provide AI usage reports in Drupal admin panel
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3535260. --> Reported by: [tonytosta](https://www.drupal.org/user/262359) Related to !826 >>> <h3 id="summary-problem-motivation">The <em>AI</em> module bundle should provide an easy way to view calls to AI providers - log requests and responses locally, build usage reports, available directly in the Drupal admin panel out of the box, without using any external tools.</h3> <h4 id="summary-steps-reproduce">Steps to reproduce (required for bugs, but not feature requests)</h4> <p>I will list these steps even though it is not required:</p> <ol> <li>Install <em>AI</em> module</li> <li>Install <em>AI Usage Reports</em> module</li> <li>See usage reports in the Drupal admin panel: logs of requests and responses, aggregations and summaries (e.g., costs; specifics to be determined)</li> </ol> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <ul> <li>Create a separate module <em>AI Usage Reports</em> that stores logs in the local database and provides the logs view UI and base reports.</li> <li>Use <a href="https://www.drupal.org/project/extended_logger">Extended Logger DB</a> module as a dependency that provides storing structured logs in the database and the Views plugin to display and aggregate free-form structured data.</li> <li>Consider using tags to mate views to details in this <a href="https://docs.google.com/document/d/1TFsgOdkj56icU11E-cr-sxtvsRIq8SlDRCpgpCYyyuE/edit?tab=t.0">report</a></li> </ul> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <ul> <li>Create default AI log entry Views page and install it using <em>AI Usage Reports</em> module</li> <li>Review this <a href="https://docs.google.com/document/d/1TFsgOdkj56icU11E-cr-sxtvsRIq8SlDRCpgpCYyyuE/edit?tab=t.0">report</a></li> <li>Build additional pages with aggregations and custom reports</li> <li>Define and commit the format to the <em>AI Usage Reports</em> report pages</li> </ul> <h3>Dependencies</h3> <p><em>AI Usage Reports</em> module should be able to generate useful logs that the view(s) can display, filter, etc.</p> > Related issue: [Issue #3549109](https://www.drupal.org/node/3549109) > Related issue: [Issue #3533109](https://www.drupal.org/node/3533109)
issue