Skip to content

runapi-ai/qwen-image-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Qwen Image PHP SDK for RunAPI

Packagist License

The Qwen Image PHP SDK is the language-specific package for Qwen Image 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 qwen-image-php split repository. For model details, use https://runapi.ai/models/qwen-image; for API reference, use https://runapi.ai/docs#qwen-image; for SDK docs, use https://runapi.ai/docs#sdk-qwen-image.

Install

composer require runapi-ai/qwen-image

Quick start

<?php

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

use RunApi\QwenImage\QwenImageClient;

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

$task = $client->textToImage->create([
    'model' => 'qwen-image-text-to-image',
    'aspect_ratio' => '1:1',
    'output_format' => 'png',
    'prompt' => 'A precise product render on white marble',
    'seed' => 1,
]);

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

$result = $client->textToImage->run([
    'model' => 'qwen-image-text-to-image',
    'aspect_ratio' => '1:1',
    'output_format' => 'png',
    'prompt' => 'A serene mountain lake at dawn',
    'seed' => 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 images in your own durable storage within 24 hours; 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 textToImage, remixImage, editImage. 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.

Releases

Packages

Contributors

Languages