All settings are managed via .env. No code changes needed to switch providers.
LARAI_AI_PROVIDER=openai # openai, anthropic, gemini
| Provider | Required Key | Models |
|---|---|---|
openai |
OPENAI_API_KEY |
gpt-4o, gpt-4o-mini |
anthropic |
ANTHROPIC_API_KEY |
claude-sonnet-4-20250514 |
gemini |
GEMINI_API_KEY |
gemini-2.0-flash |
LARAI_CHAT_MODEL=gpt-4o-mini
LARAI_EMBEDDING_MODEL=text-embedding-3-small
LARAI_VECTOR_STORE=pinecone # pinecone, pgvector, none
PINECONE_API_KEY=pcsk_your-key
PINECONE_INDEX_HOST=https://your-index.svc.pinecone.io
DB_CONNECTION=pgsql
LARAI_VECTOR_STORE=pgvector
LARAI_VECTOR_STORE=none
LARAI_EMBEDDING_DIMENSIONS=1536
LARAI_SIMILARITY_THRESHOLD=0.4
LARAI_RAG_TOP_K=5
LARAI_CHUNK_SIZE=512
LARAI_CHUNK_OVERLAP=50
LARAI_MAX_FILE_MB=20
LARAI_STORAGE_DISK=public # public or s3
Controls retry behavior for rate-limited (429) and server error (5xx) API responses from Pinecone:
LARAI_RETRY_MAX=3 # Max retry attempts
LARAI_RETRY_DELAY_MS=1000 # Base delay in ms (doubles each attempt with jitter)
LARAI_HISTORY_TURNS=10
Exposes a JSON health check at the configured path. Disabled by default — enable in production for uptime monitoring and alerting.
LARAI_HEALTH_ENABLED=true
LARAI_HEALTH_PATH=_larai/health
LARAI_HEALTH_MIDDLEWARE=auth # pipe-separated; empty = public
| Variable | Default | Notes |
|---|---|---|
LARAI_HEALTH_ENABLED |
false |
Route is not registered until this is true |
LARAI_HEALTH_PATH |
_larai/health |
No leading slash |
LARAI_HEALTH_MIDDLEWARE |
auth |
Pipe-separated middleware stack |
Use | to separate middleware, not , — commas are reserved for middleware
parameters (e.g. Laravel's rate-limit syntax throttle:60,1 = 60 requests
per minute).
LARAI_HEALTH_MIDDLEWARE=auth|throttle:60,1 # authenticated + rate-limited
LARAI_HEALTH_MIDDLEWARE=throttle:10,1 # public but rate-limited
LARAI_HEALTH_MIDDLEWARE= # fully public (use behind ingress allowlist)
Hit the endpoint with ?deep=true to run live API probes (embedding +
vector store) instead of just config validation.
.env ExampleDB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=myapp
DB_USERNAME=root
DB_PASSWORD=
LARAI_AI_PROVIDER=openai
OPENAI_API_KEY=sk-proj-...
LARAI_CHAT_MODEL=gpt-4o-mini
LARAI_EMBEDDING_MODEL=text-embedding-3-small
LARAI_VECTOR_STORE=pinecone
PINECONE_API_KEY=pcsk_...
PINECONE_INDEX_HOST=https://my-index.svc.pinecone.io
# All optional — shown with defaults
LARAI_EMBEDDING_DIMENSIONS=1536
LARAI_SIMILARITY_THRESHOLD=0.4
LARAI_RAG_TOP_K=5
LARAI_CHUNK_SIZE=512
LARAI_CHUNK_OVERLAP=50
LARAI_MAX_FILE_MB=20
LARAI_HISTORY_TURNS=10
LARAI_RETRY_MAX=3
LARAI_RETRY_DELAY_MS=1000
Change .env, then clear config:
php artisan config:clear
php artisan larai:doctor
How can I help you explore Laravel packages today?