Download the PHP package iserter/laravel-uniformed-ai without Composer
On this page you can find all versions of the php package iserter/laravel-uniformed-ai. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download iserter/laravel-uniformed-ai
More information about iserter/laravel-uniformed-ai
Files in iserter/laravel-uniformed-ai
Package laravel-uniformed-ai
Short Description Uniform AI API for Laravel (Chat, Images, Audio, Music, Search) across OpenAI, OpenRouter, Google AI Studio, KIE.AI, PIAPI.AI, Tavily, ElevenLabs, etc.
License MIT
Informations about the package laravel-uniformed-ai
Laravel Uniformed AI
A Laravel package that exposes a single, uniform API over multiple AI providers (OpenAI, OpenRouter, Google AI Studio, Replicate.com, KIE.AI, PIAPI.AI, Tavily, ElevenLabs, etc.).
Features
- Uniform Contracts for Chat, Images, Audio/Speech, Music, Video, and Web Search.
- Service Usage Logs & Cost Measuring
- Clean DTOs for all requests/responses.
- Streaming & (future) tool/function calling.
- Retries, rate limiting, caching, consistent error mapping.
- Easily extensible with custom providers.
Installation
Publish the config (optional to customize):
Set environment variables for any providers you will use:
Quick Usage
Extending
Provide a driver implementing the relevant Contract and map config / responses to the DTOs.
Testing
Uses Pest + Orchestra Testbench. Fakes HTTP calls via Http::fake() for provider payload shape + SSE streaming assertions (including mid-stream error events for OpenRouter).
Replicate chat support (prediction-based) is experimental: messages are flattened into a single prompt. Streaming & tool calls for Replicate not yet implemented.
Roadmap
- Tool calling loop helper.
- JSON / function call modes.
- Multimodal attachments.
- Batching & parallelism helpers.
- Observability (token usage + latency logs).
AI Operation Usage Logging (Observability)
This package now includes an optional, privacy‑aware logging layer that records each AI operation (chat send/stream, image create/modify/upscale, audio speak, music compose, search query).
Enable
Enabled by default. Disable globally via:
Publish migration & config first (if not already):
What Gets Logged
One row per operation with: provider, service_type, service_operation, model, status (success/error), latency_ms, started/finished timestamps, sanitized request/response JSON, optional stream chunks, exception metadata on errors, and user_id (if authenticated).
Secrets (API keys, tokens) are automatically redacted using pattern and heuristic detection. Large payload fields are truncated with a ...(truncated) suffix.
Key Config (excerpt)
Pruning
Old rows can be pruned via scheduled command:
Add to app/Console/Kernel.php schedule:
Async Persistence
Set SERVICE_USAGE_LOG_QUEUE=true and configure your queue worker to offload insert work.
Querying
Use the Iserter\UniformedAI\Models\ServiceUsageLog model:
Future enhancements (tokens, cost, sampling, external sinks) will build on this foundation.
Catalog / Introspection
You can programmatically enumerate supported providers and curated model identifiers per service without hard‑coding them in your app. This is useful for building dynamic admin panels or select dropdowns.
The list is a curated static set (Phase 1). Future versions may allow config overrides or dynamic discovery.
License
MIT
All versions of laravel-uniformed-ai with dependencies
illuminate/support Version ^11.0|^12.0|^13.0
guzzlehttp/guzzle Version ^7.7
openai-php/client Version ^0.16.1