Skip to main content

Overview

The ModelsLab PHP SDK provides a clean, object-oriented interface to interact with all ModelsLab APIs. It handles authentication, request formatting, and response parsing automatically.

Packagist

View on Packagist

GitHub

Source code and issues

Installation

Install the SDK using Composer:
Or add it to your composer.json:
Requires PHP 7.4 or higher and Guzzle HTTP client.

Quick Start

Generate your first AI image:

Client Configuration

Basic Setup

Environment Variables

Set your API key using environment variables:
Then in your code:

Image Generation

Text to Image (Realtime)

Image to Image

Community Models


Video Generation

Text to Video

Image to Video


Audio Generation

Text to Speech

Music Generation

Voice to Voice (Voice Cloning)

Sound Effects (SFX)


Image Editing

Background Removal

Super Resolution (Upscale)

Object Removal


3D Model Generation

Text to 3D


Interior Design

Interior Redesign


Error Handling

The SDK throws exceptions for various error conditions:

Async Processing Pattern

For long-running operations, poll for results:

Available APIs Summary


Next Steps

API Reference

Explore all API endpoints

Models

Browse available models

Webhooks

Set up async notifications

Error Codes

Handle errors properly