Skip to main content
Azure OpenAI requires three credentials: API key, API base URL (also called base_url or endpoint), and API version. Make sure you have all three from your Azure Portal before proceeding.

Prerequisites

Before integrating Azure OpenAI with Keywords AI, ensure you have:
  1. An active Azure OpenAI subscription
  2. At least one deployed model in your Azure OpenAI resource
  3. Your deployment name matches those listed on our Models page

How to get your Azure OpenAI credentials

1

Access Azure Portal

Visit your Azure Portal OpenAI Service.You will see your deployments. Choose the deployment you want to use.
Azure Portal deployments
2

Get your API Base URL (endpoint)

Click on the “Endpoints” link to view your API base URL.
The API base URL is also called endpoint or base_url. For OpenAI, this would be https://api.openai.com, but for Azure it’s unique to your resource (e.g., https://your-resource.openai.azure.com/).
Azure endpoint and keys
3

Get your API Key

Click on the “Manage Keys” link to view your API keys. You can use either Key 1 or Key 2.
4

Choose API Version

Pick an API version from the available Azure OpenAI versions.
  • 2024-10-21 (recommended)
  • 2024-08-01-preview
  • 2024-06-01
  • 2024-02-01

Azure OpenAI models compatibility

Add Azure OpenAI credentials

There are 2 ways to add your Azure OpenAI credentials to your requests:
1

Navigate to Providers page

Go to Providers page and select Azure OpenAI.
Providers Page
2

Add your credentials

Fill in the three required Azure OpenAI credentials:
api_key
string
required
Your Azure OpenAI API key from the Azure Portal.
api_base
string
required
Your Azure OpenAI endpoint URL (also called base_url or endpoint).
The api_base (synonyms: base_url, endpoint) is the base URL for your Azure OpenAI resource.Examples:
  • Azure OpenAI: https://your-resource.openai.azure.com/
  • OpenAI (for reference): https://api.openai.com
You can find this in your Azure Portal under “Endpoints”.
api_version
string
required
Your Azure OpenAI API version (e.g., 2024-10-21). See available versions.
Add Azure credentials
3

Map your deployment name

Azure allows custom deployment names. You need to map your deployment name so Keywords AI knows which Azure deployment to call.Important: When testing the model, use the format azure/{your-deployment-name} in the model test input.For example:
  • If your Azure deployment name is gpt-4o, use: azure/gpt-4o
  • If your Azure deployment name is my-gpt4-deployment, use: azure/my-gpt4-deployment
Azure deployment name mapping
4

(Optional) Specify models to use these credentials

You can limit which models use these credentials. Leave empty to apply your credentials for all Azure OpenAI models.To specify models:
  1. Go to the Models page
  2. Copy the model ID (e.g., azure/gpt-4o)
  3. Paste it in the input field
  4. Press Enter to add the model
Select models

Option 2: Via Code

1

Install OpenAI SDK

pip install openai
2

Initialize client with Azure credentials

from openai import OpenAI

client = OpenAI(
    base_url="https://api.keywordsai.co/api/",
    api_key="YOUR_KEYWORDSAI_API_KEY",
)

response = client.chat.completions.create(
    model="azure/gpt-4o",  # Use azure/ prefix with your deployment name
    messages=[{"role": "user", "content": "Hello, how are you?"}],
    extra_body={
        "customer_credentials": {
            "azure_openai": {
                "api_key": "YOUR_AZURE_OPENAI_API_KEY",
                "api_base": "https://your-resource.openai.azure.com/",
                "api_version": "2024-10-21",
            }
        }
    }
)
print(response)
3

(Optional) Map custom deployment names

If your Azure deployment name differs from the standard model name, use model_name_map to specify the mapping.Example: If you deployed gpt-4o with a custom name like my-gpt4-prod, map it like this:
response = client.chat.completions.create(
    model="azure/gpt-4o",
    messages=[{"role": "user", "content": "Hello"}],
    extra_body={
        "customer_credentials": {
            "azure_openai": {
                "api_key": "YOUR_AZURE_OPENAI_API_KEY",
                "api_base": "https://your-resource.openai.azure.com/",
                "api_version": "2024-10-21",
            }
        },
        "model_name_map": {
            "azure/gpt-4o": "azure/my-gpt4-prod"  # Map to your custom deployment name
        }
    }
)
model_name_map only works when your credentials are valid.
4

(Optional) Override credentials for specific models

You can override credentials for individual models without changing the default credentials.
response = client.chat.completions.create(
    model="azure/gpt-4o",
    messages=[{"role": "user", "content": "Hello"}],
    extra_body={
        "customer_credentials": {
            "azure_openai": {
                "api_key": "DEFAULT_AZURE_API_KEY",
                "api_base": "https://resource1.openai.azure.com/",
                "api_version": "2024-10-21",
            }
        },
        "credential_override": {
            "azure/gpt-4o": {  # Override for this specific model only
                "api_key": "ANOTHER_AZURE_API_KEY",
                "api_base": "https://resource2.openai.azure.com/",
                "api_version": "2024-10-21",
            }
        }
    }
)
5

(Optional) Load balance between multiple deployments

You can add multiple Azure deployments and load balance between them for better availability and cost optimization.Learn more: Load Balancing Guide

Testing your integration

Important: When testing in the model playground:
  • The “Model test call” input field should contain the model identifier: azure/your-deployment-name (e.g., azure/gpt-4o)
  • This is NOT for the message content
  • The message content goes in the separate chat input field below
  • The placeholder should show azure/gpt-4o as an example for Azure models

Requirements and troubleshooting

Requirements

  1. Deployment name format: Use azure/{deployment-name} format (e.g., azure/gpt-4o)
  2. Credentials match: Ensure your deployment name is correctly mapped if using custom names
  3. Regional availability: Confirm your models are available in the region specified by your credentials
  4. API version: Use a supported Azure OpenAI API version

Common issues

Cause: Your deployment name doesn’t match what’s configured in Azure.Solution:
  • Check your Azure deployment name in the Azure Portal
  • Use model_name_map to map the standard model name to your custom deployment name
  • Ensure you’re using the azure/ prefix (e.g., azure/gpt-4o)
Cause: One or more of your Azure credentials are incorrect.Solution:
  • Verify api_key in Azure Portal → Manage Keys
  • Verify api_base matches your resource endpoint exactly (including trailing slash)
  • Verify api_version is a valid version
Issue: The “Model test call” input field is for specifying which model to test, not the message.Correct usage:
  • Model test call input: azure/gpt-4o (the model identifier with azure/ prefix)
  • Message/chat input: Your actual message like “Hello, how are you?”
The placeholder should be dynamic and show azure/gpt-4o for Azure providers, not just gpt-4o.
Credential validation is not currently supported. Make sure your credentials are correct before making requests to avoid errors.

Supported models

DeepSeek models

  • azure_deepseek/deepseek-v3
  • azure_deepseek/deepseek-chat
  • azure_deepseek/deepseek-reasoner
  • azure_deepseek/deepseek-r1

O-series models

  • azure/o1
  • azure/o3
  • azure/o3-mini
  • azure/o4-mini

GPT-4 series

  • azure/gpt-4
  • azure/gpt-4-32k
  • azure/gpt-4-1106-preview
  • azure/gpt-4-vision-preview
  • azure/gpt-4o
  • azure/gpt-4o-mini
  • azure/gpt-4o-2024-08-06
  • azure/gpt-4.1
  • azure/gpt-4.1-mini
  • azure/gpt-4.1-nano

GPT-5 series

  • azure/gpt-5
  • azure/gpt-5-mini

GPT-3.5 series

  • azure/gpt-35-turbo
You can find the complete and up-to-date list here.