vaibhavjethva / laravel-ai-health
Health checks for Laravel AI providers via ai:health Artisan command.
Package info
github.com/vaibhavjethva/laravel-ai-health
pkg:composer/vaibhavjethva/laravel-ai-health
v0.1.0
2026-03-01 05:34 UTC
Requires
- php: ^8.3
- illuminate/support: ^11.0|^12.0
- laravel/ai: ^0.2|0.x-dev
README
Provider health checks for laravel/ai.
What This Package Does
This package adds an Artisan command:
php artisan ai:health
It checks each configured AI provider and reports:
- whether provider config exists
- whether API key is present
- whether a basic request succeeds
- request latency
- optional streaming check
Installation
Install as a normal runtime dependency:
composer require vaibhavjethva/laravel-ai-health
require vs require-dev
- Use
require(recommended): if you will runai:healthin CI, staging, or production checks. - Use
require-dev: only if you want local-only usage and do not need this command outside development.
composer require --dev vaibhavjethva/laravel-ai-health
This package uses Laravel package auto-discovery, so no manual service provider registration is required.
Usage
Check all configured providers in config/ai.php:
php artisan ai:health
Check only selected providers:
php artisan ai:health --provider=openai --json php artisan ai:health --provider=openai --provider=groq
Also test streaming:
php artisan ai:health --stream
Fail CI when any provider is unhealthy/degraded/healthy:
php artisan ai:health --fail-on=unhealthy php artisan ai:health --fail-on=degraded php artisan ai:health --fail-on=healthy
Typical Output Meaning
HEALTHY: request succeededDEGRADED: base request works but streaming check failedUNHEALTHY: config/key/request failed
Options
--provider=*Check one or more specific configured providers by config key name. Example:--provider=openai --provider=groq--streamAlso perform a streaming request test.--jsonOutput machine-readable JSON.--fail-on=healthy|degraded|unhealthyExit with code1if any checked provider matches the selected status. Default behavior is equivalent to--fail-on=unhealthy.
Exit Codes
0: no failure condition matched.1: at least one provider matched the selected failure condition.
Requirements
- PHP
^8.3 laravel/ai^0.2|0.x-devilluminate/support^11.0|^12.0
Notes
- Providers are read from
config('ai.providers'). - Missing API key is treated as
unhealthyfor providers that require keys. ollamacan be checked without an API key.
Troubleshooting
- Command not found:
run
php artisan package:discoverand try again. - All providers show
API key is missing: set provider keys in.envand verifyconfig/ai.phpmappings. - Local development with a path repository:
run
composer update vaibhavjethva/laravel-ai-health -W.