# Laravel AI SDK: a unified PHP API for OpenAI, Anthropic and Gemini

> The Laravel AI SDK wraps several model providers behind one Laravel-style interface, covering agents, structured output, images, audio and embeddings. It is early, it is opinionated, and its documentation lives on the Laravel site rather than in the repository.

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

- Repository: https://github.com/laravel/ai
- Stars: 1,202 · Forks: 344
- Language: PHP
- License: MIT
- Published: 2026-08-21 · Updated: 2026-08-21 · Language: en
- Canonical page: https://hysenlabs.com/projects/laravel-ai

## What laravel/ai actually replaces

Every provider ships its own PHP client, its own request shape, its own naming for the same concepts, and its own way of streaming a response back. A Laravel application that talks to two providers ends up with two configuration paths, two error shapes and two sets of retry logic. The Laravel AI SDK exists to collapse that into one interface. The README describes it as "a unified, expressive API for interacting with AI providers such as OpenAI, Anthropic, Gemini, and more", and lists the surface it covers: agents with tools and structured output, image generation, speech synthesis and transcription, and vector embeddings.

The audience is narrow and worth stating plainly. This is for PHP developers inside a Laravel application. If you are writing a standalone PHP service, or a Symfony application, the framework integration that makes this package pleasant is also the part you cannot use. The repository layout confirms the intent: there is a config/ directory, a database/ directory for migrations, stubs/ for generated classes, and a workbench/ directory used by the package's own test harness. Those are the markings of a package designed to be installed into an application, not dropped into a library.

A second audience is teams that already have Laravel code and want AI calls to look like the rest of it. The phrase "Laravel-friendly interface" in the README is doing real work: the bet is that a developer who knows the framework should not have to learn a new mental model to call a model.

## How the provider abstraction is laid out

The package is organised around providers rather than around features. You configure which providers exist, and the same call sites then run against whichever one is selected. The presence of a config/ directory and a stubs/ directory in the repository root points to the two halves of that arrangement: published configuration that names providers and credentials, and generated class stubs that give you a starting point for an agent rather than an empty file.

The database/ directory is the part that distinguishes this from a thin HTTP wrapper. Persisting conversation state, agent runs or embeddings implies migrations that ship with the package and get published into your application. That is a real architectural commitment: it means the SDK expects to own some tables in your schema, and it means an upgrade can touch your database. The UPGRADE.md file at the repository root exists precisely because of that kind of change.

What the README does not do is describe the request lifecycle. It does not document how a tool call is dispatched, how streaming is surfaced, or how provider-specific options pass through the abstraction. For all of that it points to https://laravel.com/docs/ai-sdk. Treat the repository as the code and the website as the manual. If you are evaluating the package by reading GitHub, you will find the shape of the thing but not the behaviour.

One design consequence is worth calling out. A unified interface means the abstraction can only expose what the providers have in common, plus whatever escape hatch exists for the rest. The README's "and more" after the provider list is honest but unhelpful: it tells you the list is not exhaustive without telling you which providers are actually supported today.

## Installing laravel/ai and making a first call

The package is distributed on Packagist under the name laravel/ai, so installation goes through Composer. The README itself does not include install steps; it points to the documentation on the Laravel website, at https://laravel.com/docs/ai-sdk, and that page is where the setup instructions live. The package name to require is the one shown in the README's Packagist badge, laravel/ai.

Once installed, the package's config/ directory is what you publish and edit to name your providers and their credentials. Because the repository ships a config/ directory and a stubs/ directory, the expected flow is: publish the configuration, set the provider keys in your environment file, then generate or write an agent class from the stub. The README does not spell out the publish command or the environment variable names, so take those from the Laravel documentation page rather than guessing.

The repository also carries a database/ directory, which means migrations are part of the install for any feature that persists state. Run your normal migration command after publishing whatever the documentation tells you to publish. What you should see is the package's tables created alongside your application's. If nothing is published, nothing is created; the migrations are not applied automatically from the vendor directory in a standard Laravel setup.

For a first real use, the README's own description is the best guide to scope: an agent with tools and structured output is the headline feature, and embeddings are the lowest-risk entry point because they have no conversation state. Start there, confirm your provider credentials work end to end, and only then move to agents. The README gives no code sample for either, so the first working example has to come from the documentation site.

## The 0.x version number is the main risk

The most recent release listed is v0.11.0, published on 2026-08-19. The default branch is named 0.x. Both facts say the same thing: the public API is not frozen. The presence of UPGRADE.md in the repository root, alongside CHANGELOG.md, is the maintainers acknowledging that upgrades require reading.

This matters more here than in a typical package because the SDK sits between your application and a third party you do not control. Provider APIs change on their own schedule, and a unified wrapper has to absorb those changes. When a provider renames a parameter or changes a response shape, the SDK either passes the change through (breaking your call sites) or normalises it (breaking anyone who relied on the previous normalisation). Neither option is free, and at 0.x the maintainers have explicitly reserved the right to pick either.

A second limitation is coverage asymmetry. The README names OpenAI, Anthropic and Gemini, then says "and more". Features are listed the same way: agents, images, audio, embeddings, "and much more". In practice these wrappers are never uniform. Image generation across three providers does not have identical parameters, and transcription options vary more than text options do. The unified interface will be thinnest exactly where the providers diverge most, and the README gives no per-provider capability matrix to tell you where those edges are.

Finally, note what the repository does not contain: there is no docs/ directory. For a package with this much surface area, the documentation being entirely off-site means the repository cannot be read as a self-contained reference, and it means version-specific documentation has to be matched to version-specific code by hand.

## How this differs from Prism

The obvious comparison for a Laravel developer is Prism, another PHP package that puts multiple AI providers behind one interface. The search data shows people asking directly: laravel ai vs prism, and laravel ai sdk vs prism.

The structural difference visible from the outside is ownership and scope. laravel/ai is published under the laravel organisation and its README points to laravel.com/docs for documentation, which places it inside the framework's own documentation and release process. Prism is a separate project with its own documentation and its own release cadence. If the SDK's direction is set by the Laravel team, then its priorities will track the framework's; if Prism's direction is set by its own maintainers, its priorities will track its users'.

The second difference is how much of the application the package expects to touch. The database/ directory here suggests the SDK is willing to own persistence for stateful features. A provider-agnostic client that stays out of your schema is a different trade: less integration, less to migrate, and no package-owned tables to reason about during an upgrade.

Neither approach is better in the abstract. If you want AI calls to be indistinguishable from the rest of your Laravel code and you are comfortable with a package that ships migrations, this fits. If you want the thinnest possible layer between your code and the provider, and you would rather manage persistence yourself, the thinner option is the safer one. The README does not make a comparison argument, and neither should you take one from a search result.

## Licence and the cost of keeping up

The package is MIT licensed, stated in the README and in the LICENSE.md file at the repository root. MIT is permissive: you can use it commercially, modify it, and ship it inside a closed product, provided the copyright notice and licence text travel with it. Nothing in the licence obliges you to publish your own changes.

What MIT does not cover is the other half of the cost. The SDK talks to paid providers, and the licence says nothing about what those calls cost you. That is a billing relationship between you and OpenAI, Anthropic or Gemini, entirely separate from this package.

The upgrade cost is the part to budget for. The repository ships UPGRADE.md, the default branch is 0.x, and the release history shows a steady cadence through the v0.10.x line into v0.11.0. Each of those minor bumps is a place where a breaking change can land, and the upgrade guide is the only reliable record of what moved. Reading it before a version bump is cheaper than reading it after a failed deploy.

Because the documentation lives on laravel.com rather than in the repository, there is also a matching problem: the docs describe the current release, and your installed version may lag it. Pin the version in composer.json and check the changelog when you move.

## Conclusion

Adopt laravel/ai if you are already on Laravel and want provider calls to look like the rest of your application code, and accept that the API is still on 0.x. Do not adopt it if you need a stable surface across a long release cycle, or if you are not using Laravel at all, since the value here is the framework integration rather than the provider clients. Before committing, read the UPGRADE.md file in the repository root to see what a version bump has cost so far, and confirm the current package version on Packagist rather than trusting a tutorial.

## FAQ

### What is the Laravel AI SDK?

It is a Laravel package that provides a unified API for interacting with AI providers such as OpenAI, Anthropic and Gemini. The README lists agents with tools and structured output, image generation, audio synthesis and transcription, and vector embeddings among its features.

### How do I use the Laravel AI SDK?

The README does not include usage steps and points to https://laravel.com/docs/ai-sdk for documentation. The repository ships a config/ directory to publish and a stubs/ directory for generated agent classes, which is where a first example starts.

### Is the Laravel AI SDK free?

The package itself is open-sourced under the MIT licence, as stated in the README and LICENSE.md. The AI providers it calls are separate services with their own billing, which the licence does not affect.

### How is laravel/ai different from Prism?

Both put multiple AI providers behind one interface for PHP. laravel/ai is published under the laravel organisation and documents itself on laravel.com, and its repository includes a database/ directory and migrations, which suggests it is willing to own persistence for stateful features.

## Sources

- [Official README](https://github.com/laravel/ai#readme)
- [Project repository](https://github.com/laravel/ai)
- [Release notes](https://github.com/laravel/ai/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/laravel-ai
