The Laravel AI SDK (laravel/ai, v0.8.1) ships with built-in support for 14 AI providers: OpenAI, Anthropic, Google Gemini, Groq, Mistral, DeepSeek, xAI, Ollama, Azure OpenAI, Cohere, OpenRouter, Jina, VoyageAI, and ElevenLabs. That breadth is genuinely useful — but unlocking it correctly requires more than swapping an env variable. This article covers how to configure multiple providers in the same application, switch between them at runtime, handle provider-specific failures, and test the whole setup without hitting a live API.
Prerequisites
PHP 8.3+
Laravel 12 or 13
laravel/ai v0.8 (pin to ^0.8 in composer.json until v1.0 ships — the package is still pre-1.0)






