> ## Documentation Index
> Fetch the complete documentation index at: https://kawax.biz/llms.txt
> Use this file to discover all available pages before exploring further.

# Laravel AI SDK Integration - VOICEVOX for Laravel

> Configure VOICEVOX for Laravel with Laravel AI SDK Audio facade in client mode and native mode.

## Laravel AI SDK integration

VOICEVOX for Laravel integrates with [Laravel AI SDK](https://github.com/laravel/ai), so you can generate speech through the `Audio` facade.

Two drivers are available:

* `voicevox-client` (client mode)
* `voicevox` (native mode)

## Client driver (`voicevox-client`)

Sends HTTP requests to the official VOICEVOX engine. No FFI required.

### Prerequisites

```shell theme={null}
docker pull voicevox/voicevox_engine:cpu-latest
docker run --rm -p '127.0.0.1:50021:50021' voicevox/voicevox_engine:cpu-latest
```

### Configuration

Add `voicevox-client` provider to `config/ai.php`.

```php theme={null}
'providers' => [
    'voicevox-client' => [
        'driver' => 'voicevox-client',
        'key' => env('VOICEVOX_URL', 'http://127.0.0.1:50021'),
    ],
],
```

### Usage

```php theme={null}
use Laravel\Ai\Audio;

$response = Audio::of('I love coding with Laravel.')
    ->voice('ずんだもん')
    ->generate('voicevox-client');

Storage::put('talk.wav', $response->content());
```

## Native driver (`voicevox`)

Calls VOICEVOX CORE directly via FFI.

Only models loaded in `core.vvms` in `config/voicevox.php` can be used.

### Configuration

```php theme={null}
'providers' => [
    'voicevox' => [
        'driver' => 'voicevox',
    ],
],
```

### Usage

```php theme={null}
use Laravel\Ai\Audio;

$response = Audio::of('ネイティブで話すのだ')
    ->voice('ずんだもん')
    ->generate('voicevox');

Storage::put('talk.wav', $response->content());
```

## Values accepted by `voice()`

`voice()` accepts:

* VOICEVOX style ID (numeric string)
* Character alias (for example, `ずんだもん`, `四国めたん/ノーマル`)

When omitted, `default-female` (ID: 10) is used.

### Alias table

| Alias            | Style ID | Character                 |
| ---------------- | -------- | ------------------------- |
| `ずんだもん`          | 1        | Zundamon (Sweet)          |
| `ずんだもん/あまあま`     | 1        | Zundamon (Sweet)          |
| `ずんだもん/ノーマル`     | 3        | Zundamon (Normal)         |
| `ずんだもん/セクシー`     | 5        | Zundamon (Sexy)           |
| `ずんだもん/ツンツン`     | 7        | Zundamon (Tsundere)       |
| `ずんだもん/ささやき`     | 22       | Zundamon (Whisper)        |
| `ずんだもん/ヒソヒソ`     | 38       | Zundamon (Murmur)         |
| `四国めたん/あまあま`     | 0        | Shikoku Metan (Sweet)     |
| `四国めたん`          | 2        | Shikoku Metan (Normal)    |
| `四国めたん/ノーマル`     | 2        | Shikoku Metan (Normal)    |
| `四国めたん/セクシー`     | 4        | Shikoku Metan (Sexy)      |
| `四国めたん/ツンツン`     | 6        | Shikoku Metan (Tsundere)  |
| `四国めたん/ヒソヒソ`     | 37       | Shikoku Metan (Murmur)    |
| `春日部つむぎ`         | 8        | Kasukabe Tsumugi (Normal) |
| `波音リツ`           | 9        | Naminori Ritsu (Normal)   |
| `雨晴はう`           | 10       | Amehare Hau (Normal)      |
| `玄野武宏`           | 11       | Kurono Takehiro (Normal)  |
| `白上虎太郎`          | 12       | Shirakami Kotaro (Normal) |
| `青山龍星`           | 13       | Aoyama Ryusei (Normal)    |
| `冥鳴ひまり`          | 14       | Meinei Himari (Normal)    |
| `九州そら`           | 16       | Kyushu Sora (Normal)      |
| `default-female` | 10       | Amehare Hau (Normal)      |
| `default-male`   | 12       | Shirakami Kotaro (Normal) |

```php theme={null}
use Laravel\Ai\Audio;

Audio::of('Test')->voice('3')->generate('voicevox-client');
```

You can also inspect available speakers via `Voicevox::speakers()`.

```php theme={null}
use Revolution\Voicevox\Voicevox;

$speakers = Voicevox::speakers();
```

## Agent (KanalizerAgent)

Native mode does not provide `enable_katakana_english`, so you can use `KanalizerAgent` to convert English text into katakana first.

```php theme={null}
use Revolution\Voicevox\Ai\Agents\KanalizerAgent;
use function Revolution\Voicevox\talk;

$kana = KanalizerAgent::make()->prompt('Convert English to katakana with KanalizerAgent');

$response = talk($kana['kana'] ?? $kana->text, id: 1)->generate(id: 1);

$response->storeAs('native', 'kanalizer.wav');
```

<Tip>
  AI-based katakana conversion is not always perfect. Review generated text before synthesis in production workflows.
</Tip>

## Next pages

<Columns cols={2}>
  <Card title="Client: Talk" href="/en/packages/laravel-voicevox/client-talk" icon="message-circle">
    Review the standard client-mode API flow.
  </Card>

  <Card title="Native: Talk" href="/en/packages/laravel-voicevox/native-talk" icon="cpu">
    Review direct FFI-based synthesis flow.
  </Card>
</Columns>
