Skip to content

kalebalebachew/hasab-laravel

Repository files navigation

Hasab AI Banner

Hasab AI Laravel SDK

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.


Why this exists

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.

Requirements

  • PHP 8.0 or higher
  • A valid Hasab API key from Hasab AI

Installation

Install with Composer:

composer require kalebalebachew/hasab-laravel

Configuration

You can publish the config file (optional):

php artisan vendor:publish --tag=hasab-config

Then add these to your .env:

HASAB_API_KEY=your_api_key_here
HASAB_BASE_URL=https://hasab.co/api
HASAB_API_VERSION=v1

Quick Start

use 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',
]);

Documentation

For detailed examples and advanced usage, check out the Usage Guide.

Contributing

Want to contribute? Check out the Contributing Guide for guidelines on how to get started.

About

A Laravel SDK for integrating with HasabAI and access its core features.

Resources

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages