1. Go to this page and download the library: Download qwen-php/qwen-php-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
qwen-php / qwen-php-client example snippets
use Qwen\QwenClient;
$apiKey = 'your-api-key';
$response = QwenClient::build($apiKey)
->query('Hello qwen, how are you today?')
->run();
echo 'API Response:'.$response;
use Qwen\QwenClient;
use Qwen\Enums\Queries\QueryRoles;
use Qwen\Enums\Models;
$apiKey = 'your-api-key';
$response = QwenClient::build($apiKey, 'https://dashscope-intl.aliyuncs.com', 500)
->query('System setup query', 'system')
->query('User input message', 'user')
->withModel(Models::QWEN_VL_MAX->value)
->run();
echo 'API Response:'.$response;
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.