All provider guides

Set up Azure OpenAI

PHP

Researched from Azure OpenAI's official documentation on 2026-11-02. Not yet walked through end to end.

Your deployment region: Use the endpoint, deployment name and API version for your actual Azure resource. A general OpenAI model name is not an Azure deployment.

Open your Azure OpenAI console (sign-in required)

  1. Current: Select a subscription and permissions

    Sign in with an Azure subscription and permissions to create Azure OpenAI resources and model deployments.

  2. Not started: Deploy a model in your region

    Create or select a compatible Azure OpenAI resource. Deploy the model you intend to call and confirm its regional quota.

  3. Not started: Get the resource endpoint and key

    From that resource, obtain its endpoint and key. Configure your own application with that endpoint, key, deployment name and compatible API version. No Azure resource is created by this site.

  4. 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.

  5. 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.

php environment names
# Set AZURE_AI_URL privately if required for your configuration.
# Set AZURE_AI_API_KEY privately if required for your configuration.
# api_version (default)
# AZURE_AI_API_VERSION=2024-10-21
# Set AZURE_AI_DEPLOYMENT privately if required for your configuration.
php local verification
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 deployment.');
}
try {
    $result = Prism::text()
        ->using('azure', $model)
        ->withPrompt('Say hello.')
        ->withMaxTokens(32)
        ->asText();
    echo $result->text, PHP_EOL;
} catch (Throwable $error) {
    echo get_class($error), PHP_EOL;
}

Official sources