Introduction

Discover OI Laravel AI and what it does for your application

OI Laravel AI

OI Laravel AI is the AI backend for a Laravel application built on top of laravel/ai. It answers four recurring needs when you ship AI features:

  • What models exist and what do they cost? — a database-backed provider/model catalog with per-1M-token pricing.
  • How much are we spending? — every agent call is recorded automatically, then aggregated into cost reports.
  • What are our agents actually prompting? — a central registry of system prompts with variable interpolation.
  • How do we keep pricing current? — a command that pulls a fresh tariff registry from a remote URL.

How it fits together

mermaid
flowchart LR
    LA["laravel/ai"] -->|AgentPrompted| ARL[AiRequestListener]
    ARL --> AR[(ai_requests)]
    REG["assets/registry.json"] -->|AiCatalog| PM[(ai_providers / ai_models)]
    AR --> AUR[AiUsageReporter]
    PM --> AUR
    AUR --> CS[cost summaries]

The package is deliberately host-agnostic: it links recorded requests back to your own Project and AgentRun models through configuration, and never persists settings directly — it delegates to a SettingStore contract your application implements.

Requirements

  • PHP 8.2+
  • Laravel 12 or 13
  • laravel/ai 0.7+

Next steps

Follow the Installation guide to add the package to your project.

Project under MIT License.
Design by