Set up Qwen / Model Studio
Researched from Qwen / Model Studio's official documentation on 2026-11-02. Not yet walked through end to end.
Singapore (international): The installed Prism default URL targets the international endpoint. Use a key and model from the matching region.
Other regions: Keys, endpoints and model lists cannot be mixed across regions. Set the matching provider URL in your own application.
Open your Qwen / Model Studio console (sign-in required)
- Current: Activate Model Studio in your region
Sign in to Alibaba Cloud and activate Model Studio in the region you plan to use.
- Not started: Create a workspace API key
In the Model Studio API Key page, select that region, choose Create API Key and select the appropriate workspace and owner.
- Not started: Match the key, model and region
Copy the newly created key into your own secret storage. Keep the key, model and service endpoint in the same region; do not substitute a Coding Plan key for a pay-as-you-go key.
- Not started: Configure your .env
Use the environment names below in your own application. Keep its environment file out of source control. Never paste a key into this website.
- Not started: Run the local check
Choose a model you can use and run the matching example below on your own machine. Check any applicable usage charges first.
This provider is available in PHP Prism. The TypeScript and Python ports do not implement it.
Configure and verify locally
Environment names and defaults below come from the installed package. Choose a model you can use by setting PRISM_SETUP_MODEL on your machine. Run the verification only when you are ready for one billed request. No request is sent by this page.
Approximate text cost is input tokens × your model’s input rate, plus at most 32 output tokens × its output rate, divided by the rate’s token unit. Add any provider fees. Check your model and region’s current price; the token limit is not a money cap.
use Prism\Prism\Facades\Prism;
// Run in your own configured Laravel app (for example, php artisan tinker).
$model = getenv('PRISM_SETUP_MODEL');
if (!$model) {
throw new RuntimeException('Set PRISM_SETUP_MODEL to your model.');
}
try {
$result = Prism::text()
->using('qwen', $model)
->withPrompt('Say hello.')
->withMaxTokens(32)
->asText();
echo $result->text, PHP_EOL;
} catch (Throwable $error) {
echo get_class($error), PHP_EOL;
}