- >= 7.0
You can install the package via composer:
composer require blockadelabs/sdk
Before you are able to use the SDK, you need to edit your .env
file and add your Blockade Labs API key:
BLOCKADE_LABS_API_KEY=YOUR_API_KEY
Package will register a Facade that you can use in your app to make API calls, just make sure to include it at the top of the file:
use BlockadeLabs\SDK\Facades\BlockadeLabsClient;
All the methods and routes are also explained (in greater detail) in the Docs here.
$skyboxStyles = BlockadeLabsClient::getSkyboxStyles();
$skybox = BlockadeLabsClient::generateSkybox([
'prompt' => 'PROMPT_GOES_HERE', // Required
'skybox_style_id' => '2', // Required,
'remix_imagine_id' => 1, // OR remix_obfuscated_id / Optional
'webhook_url' => 'YOUR_WEBHOOK_URL', // Optional
]);
You can refer to the docs here and here for more details on how to generate new skyboxes and how to generate skyboxes that are remixes of previously generated skyboxes.
$generators = BlockadeLabsClient::getGenerators();
$generateImagine = BlockadeLabsClient::generateImagine([
'generator' => 'stable-skybox', // REQUIRED
'prompt' => 'PROMPT_GOES_HERE', // REQUIRED
'init_image' => $request->file('init_image') // example for the init_image file param
...other_generator_data_params, // Optional
'webhook_url' => 'YOUR_WEBHOOK_URL', // Optional
]);
You can refer to the docs here and here on how to get and use generator data when generating imagines.
The generateImagine
method can accept different types of generator data, which may include files.
When sending files it's enough to just pass the file from the request, like so:
'init_image' => $request->file('init_image'),
$generateImagine = BlockadeLabsClient::generateImagine([
'generator' => 'stable-skybox',
'prompt' => 'some prompt',
]);
$imagine = BlockadeLabsClient::getImagineById($generateImagine['request']['id']);
$generateImagine = BlockadeLabsClient::generateImagine([
'generator' => 'stable-skybox',
'prompt' => 'some prompt',
]);
$imagine = BlockadeLabsClient::getImagineByObfuscatedId($generateImagine['request']['obfuscated_id']);
$myImagines = BlockadeLabsClient::getImagineHistory([
'status' => 'IMAGINE_STATUS', // OPTIONAL
'limit' => 10, // OPTIONAL
'offset' => 0, // OPTIONAL
'order' => 'ASC', // OPTIONAL
'imagine_id' => 1, // OPTIONAL
'query' => 'PROMPT', // OPTIONAL
'generator' => 'GENERATOR', // OPTIONAL
]);
$generateImagine = BlockadeLabsClient::generateImagine([
'generator' => 'stable-skybox',
'prompt' => 'some prompt',
]);
$result = BlockadeLabsClient::cancelImagine($generateImagine['request']['id']);
$result = BlockadeLabsClient::cancelAllPendingImagines();
$generateImagine = BlockadeLabsClient::generateImagine([
'generator' => 'stable-skybox',
'prompt' => 'some prompt',
]);
$result = BlockadeLabsClient::deleteImagine($generateImagine['request']['id']);
Please see CHANGELOG for more information on what has changed recently.