AzureOpenAI client chat completion does not work with o3-mini

Hello,
when using openai.AzureOpenAI client with o3-mini I get:

Error code: 400 - {'error': {'code': 'OperationNotSupported', 'message': 'The chatCompletion operation does not work with the specified model, o3-mini. Please choose different model and try again. You can learn more about which models can be used with each operation here: [https://go.microsoft.com/fwlink/?linkid=2197993]

This is my code

from openai import AzureOpenAI

client = AzureOpenAI(
    api_version="2024-12-01-preview",
    azure_endpoint="https://<my_endpoint>.openai.azure.com/",
    api_key="<my_api_key>",
)

response = client.chat.completions.create(
    messages=[
        {
            "role": "system",
            "content": "You are a helpful assistant.",
        },
        {
            "role": "user",
            "content": "I am going to Paris, what should I see?",
        }
    ],
    max_completion_tokens=100000,
    model="<my_o3_mini_deployment_name>"
)

print(response.choices[0].message.content)

Please notice that:

  1. The same code perfectly works when using o3-mini with OpenAI client
  2. The same code perfectly works when using a gpt-4o deployment with AzureOpenAI client
  3. I am using the latest openai python package 1.66.3.
  4. The same issue has been recently reported on the GitHub repo AzureOpenAI client chat completion does not work with o3-mini · Issue #2173 · openai/openai-python · GitHub but has been closed without a solution.

Thank you!
Davide

3 Likes

In the same boat, Azure Open AI o3-mini responding the same for me since March 10th, 2025

1 Like