Skip to content

New responses API does not work with AzureOpenAI #2184

@alexprengere

Description

@alexprengere

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

On the latest version of openai==1.66.2, I have this current code that works well:

import os
from openai import AzureOpenAI

client = AzureOpenAI(
    api_version=os.getenv("OPENAI_API_VERSION"),
    api_key=os.getenv("OPENAI_API_KEY"),
    azure_endpoint=os.getenv("OPENAI_AZURE_ENDPOINT"),
)

completions = client.chat.completions.create(
    model=os.getenv("OPENAI_AZURE_DEPLOYMENT"),
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "What is the capital of the United States?"},
    ],
)
print(completions.choices[0].message.content)
# returns 'The capital of the United States is Washington, D.C.'

I wanted to test the new responses API, so I followed the docs:

import os
from openai import AzureOpenAI

client = AzureOpenAI(
    api_version=os.getenv("OPENAI_API_VERSION"),
    api_key=os.getenv("OPENAI_API_KEY"),
    azure_endpoint=os.getenv("OPENAI_AZURE_ENDPOINT"),
)

response = client.responses.create(
    model=os.getenv("OPENAI_AZURE_DEPLOYMENT"),
    instructions="You are a coding assistant that talks like a pirate.",
    input="How do I check if a Python object is an instance of a class?",
)
print(response.output_text)

But this results in:

openai.NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}

Am I missing something or is this just not supported yet? Note that the deployed model on Azure is GPT-4o.

To Reproduce

All information required is above.

Code snippets

OS

Fedora

Python version

Python3.10

Library version

openai==1.66.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions