Library / SDK
laravel/ai avatar
laravel/ai

Laravel AI SDK: A Unified PHP Client for OpenAI, Anthropic, and Gemini

The Laravel AI SDK provides a unified, expressive API for interacting with AI providers such as OpenAI, Anthropic, Gemini, and more.

1,269 stars382 forksPHPMIT

At a glance

What is it?
Laravel's official AI SDK wraps multiple AI providers behind one PHP API, with tools, structured output, and audio and image support. Still in 0.x, it trades stability for a fast-moving feature set.
Who is it for?
Adopt the Laravel AI SDK if you are already in the Laravel ecosystem, want a single PHP interface across OpenAI, Anthropic, and Gemini, and can tolerate pre-1.0 API changes. Skip it if you need a stable contract, work outside Laravel, or require a provider-agnostic SDK with long-term support.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 1 day ago.
What is it written in?
Mainly PHP, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 14, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • laravel/ai1,269 ★ · +162
Star history
Repository2026-08-212026-11-14
laravel/ai1.1k1.3k

162 Stars in the last 85 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

What the Laravel AI SDK Solves and Who It Targets

The Laravel AI SDK addresses a specific pain: PHP applications that need to talk to several AI providers without writing a separate client for each. The README describes a unified, expressive API for providers such as OpenAI, Anthropic, and Gemini. That means you can write one set of calls for text generation, tools, structured output, images, audio, and embeddings, and swap the provider underneath. The intended audience is Laravel developers, since the SDK is built to feel Laravel-friendly, with the official documentation hosted on the Laravel website. If you are not using Laravel, this package may still work, but its design choices, such as facades or service containers, likely assume a Laravel base.

The Unified API and Its Scope

The core promise is consistency. Instead of learning OpenAI's PHP SDK, Anthropic's PHP SDK, and Gemini's PHP SDK, you learn one interface. The README lists capabilities: building intelligent agents with tools and structured output, generating images, synthesizing and transcribing audio, and creating vector embeddings. That is a wide surface area. The SDK does not just wrap chat completions; it covers modalities that many SDKs split into separate packages. For a Laravel developer, this means fewer dependencies and a single place to configure API keys and handle responses. The trade-off is that the unified API can only expose the lowest common denominator across providers. If one provider has a unique feature, like a specific image style parameter, the SDK may either hide it or expose it in a non-standard way. The documentation on the Laravel site would clarify how deep the abstraction goes, but the README alone does not.

Getting Started: Installation and Basic Usage

The README does not include installation commands or code examples, so I cannot show a specific composer command or a config key. The package is on Packagist, indicated by the badges in the README, and the standard Laravel route would be composer require laravel/ai. The documentation at laravel.com/docs/ai-sdk is the place to look for concrete setup steps. Given the 0.x versioning, you should expect the configuration format to change. The README's mention of expressive API suggests a fluent style, similar to Laravel's query builder or HTTP client, but that is an inference. For exact commands, you must consult the official docs.

Version 0.x: The Maturity Trade-off

The default branch is 0.x, and the latest release is v0.11.0, pushed on 2026-08-19. The previous releases, v0.10.3 and v0.10.2, came within weeks of each other in July and August 2026. That release cadence shows active development, but 0.x also signals that the API is not stable. Semantic versioning rules say that any minor version bump before 1.0 can introduce breaking changes. For a project like this, that means your code may break when you upgrade from v0.10.3 to v0.11.0. The short gap between releases suggests the maintainers are iterating quickly, adding features or fixing issues. This is a real limitation: if you need a stable contract for a production system, you will need to pin the exact version and budget time for upgrades. The MIT license does not protect you from API changes; it only covers the code's usage rights.

A Genuine Limitation: Provider Coverage and Consistency

The README names OpenAI, Anthropic, and Gemini, but the phrase and more leaves room for others. That is a limitation in itself: you do not know which providers are officially supported until you read the docs. More importantly, a unified API forces a common feature set. If one provider does not support a feature, like structured output or audio transcription, the SDK cannot offer it uniformly. You may end up writing provider-specific fallbacks, which defeats the purpose of a single interface. The documentation likely explains how each provider maps to the unified API, but the README does not. For a developer evaluating the SDK, the key question is whether your required features are available on all target providers. If not, you will be writing conditional code anyway.

The Alternative: Provider-Specific SDKs

The obvious alternative is to use each provider's official PHP SDK directly. OpenAI has its own PHP client, Anthropic provides one, and Google has a Gemini PHP library. The difference is in approach: provider-specific SDKs give you full access to every feature of that provider, with no abstraction layer. You write more code, manage multiple packages, and handle different response formats, but you never lose a provider-specific capability. The Laravel AI SDK trades that granularity for convenience. If your project only uses one provider, a provider-specific SDK is simpler and less risky. If you need to switch providers or support several, the Laravel SDK can save time, but only if the abstraction covers what you need. The README's claim of a consistent interface is a promise, not a guarantee, and the 0.x status means that promise is still evolving.

Maintenance and Upgrade Cost

The maintenance cost is tied to the 0.x version. With releases every few weeks, you will see frequent updates. Each update may require changes to your code, especially if you use tools or structured output, which are complex features that often shift between versions. The README does not mention a changelog or an upgrade guide, but the Laravel documentation likely includes one. The MIT license means you can fork the project and fix issues yourself, but that is a heavy burden. The security policy is mentioned, so you can report vulnerabilities, but the responsibility for applying updates falls on you. Before adopting, check the documentation for a list of breaking changes between 0.x versions. If the project reaches 1.0, the upgrade cost will drop, but until then, budget for regular maintenance.

Editorial conclusion

Adopt the Laravel AI SDK if you are already in the Laravel ecosystem, want a single PHP interface across OpenAI, Anthropic, and Gemini, and can tolerate pre-1.0 API changes. Skip it if you need a stable contract, work outside Laravel, or require a provider-agnostic SDK with long-term support. Before adopting, verify that the current 0.x API matches your use cases for tools, structured output, and audio or image generation, and pin your dependency to a specific version, as the 0.x line may introduce breaking changes between releases.

Frequently asked questions

What is the Laravel AI SDK?

A PHP package that provides a unified, expressive interface to AI providers such as OpenAI, Anthropic and Gemini. With it you can build agents with tools and structured output, generate images, synthesise and transcribe audio, and create vector embeddings, through one Laravel-friendly interface.

How do I install the Laravel AI SDK?

The README gives no install command. It links to the documentation on the Laravel website and to the package page on Packagist, and the repository ships a Composer manifest at its root. The framework version the package targets is not stated in the repository.

Which AI providers does the Laravel AI SDK support?

The introduction names OpenAI, Anthropic and Gemini, and then says and more. No further provider list appears in the repository, and no capability is mapped to a provider, so the specification has to come from the documentation the README links.

Is the Laravel AI SDK free?

Yes, it is licensed under the MIT licence, and the README links a licence file that is present in the repository root. The documentation, contribution guide, code of conduct and security policy are all hosted on the Laravel website rather than in the repository.

How do I upgrade to Laravel AI SDK 1.0?

The repository contains UPGRADE.md and a CHANGELOG.md, neither of which the README links. The README points only at the documentation, contribution guide, code of conduct, security policy and licence, so the upgrade path has to be found in the tree rather than from the front page.

Does the Laravel AI SDK compare itself with other PHP AI packages?

No. The repository contains no comparison with any other package, and the documentation it links is hosted outside the repository, so an evaluation starts from the vendor's documentation site rather than from these files.

Official sources

  1. Official README
  2. Project repository
  3. Release notes
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/laravel-ai.svg)](https://hysenlabs.com/projects/laravel-ai)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/laravel-ai.svg)](https://hysenlabs.com/projects/laravel-ai)

Was this useful?