> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qualifire.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure OpenAI

> Integrate your application with Azure OpenAI

<Steps>
  <Step title="Create an account + Generate an API Key">
    Log into [qualifire](https://qualifire.ai) or create an account. Once you have an account, you
    can generate an [API key](https://qualifire.ai/settings/api-keys).
  </Step>

  <Step title="when setting the integration also set a base url">
    <Note>
      Azure OpenAI requires a base url to be set. This can be done by setting the base url in the
      integration settings.
    </Note>
  </Step>

  <Step title="Set QUALIFIRE_API_KEY as an environment variable">
    ```javascript theme={null}
    QUALIFIRE_API_KEY=<your API key>
    ```
  </Step>

  <Step title="Modify the base path and add a X-Qualifire-Api-Key header">
    <Note>
      If you created a direct integration, you can omit the `defaultHeaders`
      property.
    </Note>

    <CodeGroup>
      ```python Python OpenAI theme={null}
      import os
      from openai import AzureOpenAI

      deployment = os.getenv("DEPLOYMENT_NAME", "qualifire-gpt-4")
      subscription_key = os.getenv("AZURE_OPENAI_API_KEY", "REPLACE_WITH_YOUR_KEY_VALUE_HERE")

      # Initialize Azure OpenAI client with key-based authentication
      client = AzureOpenAI(
          azure_endpoint = "https://proxy.qualifire.ai/api/providers/openai",
          deployment_id = deployment,
          api_key = subscription_key,
          api_version = "2024-05-01-preview",
      )

      ```

      ```javascript JavaScript OpenAI theme={null}
      import { AzureOpenAI } from "openai";

      const deployment = process.env.DEPLOYMENT_NAME || "qualifire-gpt-4";

      const client = new AzureOpenAI({
        endpoint: "https://proxy.qualifire.ai/api/providers/openai",
        deployment,
        apiKey: process.env.AZURE_OPENAI_API_KEY,
        apiVersion: "2024-05-01-preview",
      });
      ```
    </CodeGroup>

    <Warning>
      Azure OpenAI requires a base URL to be configured in the integration settings. Make sure the base URL in your Qualifire integration matches your Azure OpenAI resource endpoint.
    </Warning>
  </Step>
</Steps>
