A simple Laravel SDK for integrating with Hasab AI.
It gives you a clean way to access Hasab's core features — transcription, translation, text-to-speech (TTS), and chat — without writing repetitive HTTP logic.
This package is intentionally small and follows normal Laravel patterns.
You get config publishing, a service provider, a facade, and a few service classes. No extra layers just straightforward code that works.
Hasab provides powerful AI endpoints, but using them directly from Laravel requires setting up headers, base URLs, and file uploads each time.
This SDK wraps those calls with a consistent interface so you can work like this:
Hasab::tts()->synthesize('Hello world', 'eng');instead of manually handling authentication or request payloads.
- PHP 8.0 or higher
- A valid Hasab API key from Hasab AI
Install with Composer:
composer require kalebalebachew/hasab-laravelYou can publish the config file (optional):
php artisan vendor:publish --tag=hasab-configThen add these to your .env:
HASAB_API_KEY=your_api_key_here
HASAB_BASE_URL=https://hasab.co/api
HASAB_API_VERSION=v1use Hasab\Facades\Hasab;
// Chat
$response = Hasab::chat()->complete([
'message' => 'Hello, how are you?',
'model' => 'hasab-1-lite',
]);
// Text-to-Speech
$audio = Hasab::tts()->synthesize([
'text' => 'Hello, world!',
'language' => 'eng',
]);
// Transcription (⚠️ Ongoing Implementation)
$transcription = Hasab::transcription()->upload([
'file' => storage_path('app/audio/recording.mp3'),
]);
// Translation (⚠️ Ongoing Implementation)
$translation = Hasab::translation()->translate([
'text' => 'Hello, how are you?',
'source_language' => 'eng',
'target_language' => 'amh',
]);For detailed examples and advanced usage, check out the Usage Guide.
Want to contribute? Check out the Contributing Guide for guidelines on how to get started.
