Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Topaz PHP SDK for RunAPI

Packagist License

The Topaz PHP SDK is the language-specific package for Topaz on RunAPI. Use this package when your application needs Composer installs, associative-array request bodies, task status lookup, and consistent RunAPI errors in PHP.

This README is the PHP package guide for the public topaz-php split repository. For model details, use https://runapi.ai/models/topaz; for API reference, use https://runapi.ai/docs/api/topaz/upscale-image; for SDK docs, use https://runapi.ai/docs/resources/sdks.

Install

composer require runapi-ai/topaz

Quick start

<?php

require __DIR__ . "/vendor/autoload.php";

use RunApi\Topaz\TopazClient;

$client = new TopazClient(); // reads RUNAPI_API_KEY

$upscaleVideoTask = $client->upscaleVideo->create([
    'model' => 'topaz-upscale-video',
    'source_video_url' => 'https://cdn.runapi.ai/public/samples/video.mp4',
    'upscale_factor' => 1,
]);

$task = $client->upscaleImage->create([
    'model' => 'topaz-upscale-image',
    'source_image_url' => 'https://cdn.runapi.ai/public/samples/image.jpg',
    'upscale_factor' => 1,
]);

$status = $client->upscaleImage->get($task->id);

$result = $client->upscaleImage->run([
    'model' => 'topaz-upscale-image',
    'source_image_url' => 'https://cdn.runapi.ai/public/samples/image.jpg',
    'upscale_factor' => 1,
]);

echo $result->images[0]->url . PHP_EOL;

Use create() to submit a task and return quickly, get() to fetch the latest task state, and run() when a script should create and poll until completion. In web request handlers, prefer create() plus webhook or later get() polling so a worker is not held open.

RunAPI-generated file URLs are temporary. Download and store generated files in your own durable storage within the retention window; do not treat returned URLs as long-term assets.

Language notes

Pass request parameters as associative arrays with snake_case keys. The available resources are upscaleImage, upscaleVideo. Keep RUNAPI_API_KEY in the environment or your secret manager; never commit API keys or callback secrets.

Links

License

Licensed under the Apache License, Version 2.0.

About

RunAPI Topaz Composer package for PHP applications

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages