aistemsplitter / aistemsplitter-php
Official PHP SDK for the AIStemSplitter public API.
Package info
github.com/aistemsplitter/aistemsplitter-php
pkg:composer/aistemsplitter/aistemsplitter-php
Requires
- php: >=8.1
This package is not auto-updated.
Last update: 2026-05-10 04:43:19 UTC
README
Official PHP SDK for AIStemSplitter, an AI-powered stem splitter that separates vocals, drums, bass, and other instruments from uploaded audio files or direct audio URLs.
Links
- Homepage: https://aistemsplitter.org
- API docs: https://aistemsplitter.org/developers/api
- OpenAPI: https://api.aistemsplitter.org/openapi.yaml
Features
- Vocal isolation and remover workflows
- Drum, bass, and instrumental stems
- Async API with webhook callbacks
- Pay-as-you-go credits
Get an API Key
Sign up at aistemsplitter.org and use AISTEMSPLITTER_API_KEY in local examples.
Install
composer require aistemsplitter/aistemsplitter-php
Quickstart
<?php require __DIR__ . '/vendor/autoload.php'; use AIStemSplitter\Client; $client = new Client(getenv('AISTEMSPLITTER_API_KEY')); $credits = $client->getCredits(); echo $credits['balance'] . ' ' . $credits['unit'] . PHP_EOL; $split = $client->createSplit([ 'input' => [ 'type' => 'direct_url', 'url' => 'https://example.com/song.mp3', ], 'stemModel' => '6s', ], idempotencyKey: 'retry-001'); $result = $client->waitForSplit($split['id'], timeoutMs: 10 * 60 * 1000, intervalMs: 2000); print_r($result['stems'] ?? []);
Upload Then Split
$upload = $client->uploadAudio( filename: 'song.mp3', contentType: 'audio/mpeg', contents: file_get_contents(__DIR__ . '/song.mp3'), ); $split = $client->createSplit([ 'input' => $upload['input'], 'stemModel' => '4s', ]);
Smoke Example
AISTEMSPLITTER_API_KEY=ast_live_xxx php examples/smoke.php
Without AISTEMSPLITTER_API_KEY, the smoke example exits cleanly with setup instructions.
Development
composer validate --strict
composer test
php -l src/Client.php
php -l src/AIStemSplitterException.php
Publishing to Packagist is blocked until the github.com/aistemsplitter/aistemsplitter-php repository exists and the package is submitted or linked in Packagist.