---
title: "Workers AI for Laravel"
description: "Cloudflare Workers AI provider for the Laravel AI SDK: text, embeddings, reranking, images, speech, transcription, Clef decisions and Clairic typed extraction, with AI Gateway routing."
---

> Documentation Index
> Fetch the complete documentation index at: https://laravel-cf-workersai-docs.mdick85.workers.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Workers AI for Laravel

<div class="mx-auto max-w-4xl px-6 py-16">

<p class="text-sm font-medium text-muted-foreground">A Cloudflare Workers AI provider for Laravel AI</p>

<h1 class="mt-3 text-4xl font-semibold tracking-tight text-balance">Cloudflare Workers AI in Laravel, with Clef and Clairic.</h1>

<p class="mt-4 max-w-3xl text-lg text-muted-foreground text-pretty">Cloudflare Workers AI provider for the Laravel AI SDK: text, embeddings, reranking, images, speech, transcription, Clef decisions and Clairic typed extraction, with AI Gateway routing.</p>

<div class="mt-8 flex flex-wrap gap-3">

Quickstart

Overview

GitHub

</div>

<pre class="mt-10 overflow-x-auto rounded-lg border border-border bg-muted/40 p-4 text-sm"><code>composer require meirdick/laravel-cf-workersai</code></pre>

<h2 class="mt-14 text-2xl font-semibold tracking-tight">Answers, not generated text</h2>

<p class="mt-2 text-muted-foreground">Clef and Clairic are System One models. They do not generate tokens. They read your input in one pass and return typed answers with probabilities.</p>

<div class="mt-6 grid gap-4 md:grid-cols-2">

<div class="min-w-0">

**Clef decides** among options you list.

```php
use Laravel\Ai\Classification;
use Laravel\Ai\Classification\Boolean;

$response = Classification::of($ticket)
    ->question('urgent', new Boolean('Urgent?'))
    ->classify(provider: 'workers-ai');

$response['urgent']->isTrue();
```

Clef guide

</div>

<div class="min-w-0">

**Clairic extracts** a value of the type you ask for, or null.

```php
use Meirdick\WorkersAi\Extraction;
use Meirdick\WorkersAi\Extraction\Number;

$invoice = Extraction::of($text)
    ->field('total', new Number(unit: 'USD'))
    ->extract();

$invoice['total']->value();
```

Clairic guide

</div>

</div>

<div class="mt-14 grid gap-4 sm:grid-cols-3">

- **All of Laravel AI** — Text, tools, embeddings, reranking, images, speech and transcription, with the Laravel AI code you already write.
- **Direct or gateway** — One config key adds AI Gateway logs, caching and rate limits. Your calling code does not change.
- **Cloudflare failures handled** — A token cap, an exception on an empty answer, retries for edge errors, and neuron figures.

</div>

<p class="mt-14 text-sm text-muted-foreground">Needs PHP 8.3 and <code>laravel/ai</code> 0.9 to 1.3. Clef needs <code>laravel/ai</code> 1.0 or later. MIT license.</p>

</div>

Source: https://laravel-cf-workersai-docs.mdick85.workers.dev/docs/index.mdx
