Skip to content

Artisan commands

CommandDescription
ai:make-taskGenerate a task class
ai:requestAd-hoc sync or queued request
ai:runsList recent ai_runs
ai:retryRe-dispatch failed and stuck runs
ai:budgetTenant’s spend vs limit
ai:modelsModels available from a provider’s API
Terminal window
php artisan ai:make-task SummarizeTask
php artisan ai:make-task Orders/AnalyzeTask --queued

Creates the class in App\Ai\Tasks (subdirectories via /), with SerializesModelsAi.

OptionDescription
--queuedImplement ShouldQueueAi
--forceOverwrite an existing file
Terminal window
php artisan ai:request "Summarize the plot of Hamlet"
php artisan ai:request "..." --driver=anthropic --raw
php artisan ai:request "..." --queue
OptionDescription
--driver=Driver name
--modality=texttext or embed
--temperature=Sent only when given (some models reject it)
--tenant=Tenant ID
--queueDispatch to the queue, print the run id
--jsonPrint the content only
--rawAlso print usage: tokens, cost
Terminal window
php artisan ai:runs --task=summarize --status=dead --limit=50
OptionDescription
--tenant=Filter by tenant
--task=Filter by task name
--status=Filter by status
--limit=20Rows

Re-dispatches runs with status error or dead: rebuilds the task from task_class/task_args in ai_runs.request and re-queues it into the same row (status goes back to queued).

Terminal window
php artisan ai:retry # failures from the last 24h
php artisan ai:retry --since=1h --limit=10
php artisan ai:retry --stuck # also stuck queued/running runs
php artisan ai:retry --dry-run # list only, change nothing
OptionDescription
--since=24hPeriod in hours
--limit=50Max runs
--stuckInclude stuck runs
--dry-runOnly list what would be retried

Task constructor arguments are stored only with AI_STORE_REQUEST=true — runs recorded without them are listed as skipped. Tasks whose constructor has no required parameters can always be retried.

A failed attempt of a sync call whose fallback driver then answered is not retried — the call already has its result (response.superseded_by points to the row that answered).

Terminal window
php artisan ai:budget tenant-abc
php artisan ai:budget tenant-abc --month=2026-09
php artisan ai:budget tenant-abc --from=2026-09-01 --to=2026-09-15
Argument / optionDescription
tenantTenant ID, default default
--month=Month YYYY-MM
--from=, --to=Date range YYYY-MM-DD; --to defaults to today
Terminal window
php artisan ai:models # all configured drivers
php artisan ai:models gemini # one driver
php artisan ai:models openai --filter=gpt-5 # filter by substring
php artisan ai:models anthropic --detail # token limits, release date, capabilities

The currently configured model is marked with ✓. Groq, Mistral, DeepSeek, xAI, Ollama and OpenRouter are queried via the OpenAI-compatible /v1/models endpoint at each provider’s default URL; set ai.providers.{driver}.url only to override it (e.g. a self-hosted Ollama).

From code — AI::models().