Skip to main content

What is engine API mode

Engine API mode provides a VOICEVOX Engine-compatible HTTP API inside your Laravel app. Start your app with php artisan serve --port=50513, then use endpoints like /audio_query and /synthesis directly.

Prerequisites

1

Set up VOICEVOX Core for PHP

Follow Installation and Configuration to prepare voicevox-core-php and core libraries.
2

Configure environment and enable FFI

VOICEVOX_CORE_PATH=/path/to/voicevox_core/
ffi.enable=true
3

Install character resources

php artisan voicevox:install

Start Laravel engine

php artisan serve --port=50513
Default URL is http://127.0.0.1:50513.

About port 50513

The official VOICEVOX engine uses port 50021 by default. Port 50513 is chosen so you can run the Laravel engine and the official engine at the same time. You are free to use any other port — just pass a different --port value, such as --port=8000.
The official engine automatically picks the next available port (50022, 50023, …) when 50021 is busy. php artisan serve does the same when no --port is given (8001, 8002, …), but it fails to start if the specified port is already in use. Choose a fixed port that is unlikely to conflict with other services. Port 50513 is one example chosen to avoid collisions with both the official VOICEVOX engine (50021) and common Laravel ports.

Generate talk audio

1. Create audio_query

curl -s -X POST "http://127.0.0.1:50513/audio_query?speaker=1&text=I%20love%20Laravel" \
  -H "Content-Type: application/json" \
  > audio_query.json

2. Synthesize with synthesis

curl -s -X POST "http://127.0.0.1:50513/synthesis?speaker=1" \
  -H "Content-Type: application/json" \
  -d @audio_query.json \
  > talk.wav

Use from Laravel client mode

Point client-mode URL to the Laravel engine API.
// config/voicevox.php
'client' => [
    'url' => env('VOICEVOX_URL', 'http://127.0.0.1:50513'),
],
use Revolution\Voicevox\Voicevox;

$response = Voicevox::talk('I love Laravel', id: 1)
    ->generate(id: 1);

$response->storeAs('engine', 'talk.wav');

Enable/disable and fallback

'engine' => [
    'disabled' => env('VOICEVOX_ENGINE_DISABLED', false),
    'fallback_url' => env('VOICEVOX_ENGINE_FALLBACK_URL', 'http://127.0.0.1:50021'),
],
Unsupported endpoints like cancellable_synthesis and multi_synthesis can fall back to official engine.
If you rely on fallback, run official VOICEVOX engine at VOICEVOX_ENGINE_FALLBACK_URL.

Talk endpoint support

EndpointLaravel engineFallbackNotes
POST /audio_queryenable_katakana_english unsupported
POST /accent_phrasesenable_katakana_english unsupported
POST /synthesis
POST /mora_data
POST /mora_length
POST /mora_pitch
GET /speakers
GET /speaker_infoRequires resource install
POST /cancellable_synthesisFallback only
POST /multi_synthesisFallback only

OpenAI-compatible TTS endpoint

POST /v1/audio/speech accepts the same request format as the OpenAI speech API. Changing the Base URL is all you need to connect any OpenAI-compatible tool — including Laravel AI SDK.
curl -s -X POST "http://127.0.0.1:50513/v1/audio/speech" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "voicevox",
    "input": "I love Laravel",
    "voice": "shimmer"
  }' \
  > talk.wav

Parameters

ParameterDescription
inputText to synthesize (max 4096 characters)
voiceStyle ID (integer), character alias (ずんだもん, 四国めたん, etc.), or OpenAI voice name (alloy, shimmer, etc.)
speedPlayback speed applied as speedScale (0.25–4.0, default 1.0)
response_formatAlways returns wav. The value is ignored
Other parametersIgnored
OpenAI voice names (alloy, shimmer, etc.) are provisional mappings. There is no authoritative definition of how each OpenAI voice should correspond to a VOICEVOX character, so these are convenience assignments for compatibility. Using VOICEVOX character aliases (ずんだもん, 四国めたん/ノーマル, etc.) is recommended.

Next pages

Engine API: Song

Use sing_frame_audio_query and frame_synthesis endpoints.

Laravel AI SDK Integration

Configure VOICEVOX with Audio facade workflows.
Last modified on May 25, 2026