Skip to content

feat(azure): add Responses API support for Azure OpenAI provider#5201

Open
kunalk16 wants to merge 8 commits intocrewAIInc:mainfrom
kunalk16:feat/azure-responses-api
Open

feat(azure): add Responses API support for Azure OpenAI provider#5201
kunalk16 wants to merge 8 commits intocrewAIInc:mainfrom
kunalk16:feat/azure-responses-api

Conversation

@kunalk16
Copy link
Copy Markdown

@kunalk16 kunalk16 commented Apr 1, 2026

Closes: #5202

Summary
Adds support for OpenAI's Responses API to the Azure OpenAI provider. Users can now opt in by setting api="responses" when creating an LLM instance. The existing Chat Completions API path remains the default and is completely untouched.

The Responses API is OpenAI's recommended API for new development, replacing Chat Completions as the primary interface. Azure OpenAI has adopted it with full feature parity.

# Example 1 basic
llm = LLM(model="azure/gpt-5.4-mini", api="responses")

# Example 2 with instructions
llm = LLM(model="azure/gpt-5.4-mini", api="responses", instructions="Be concise.")
Click to view Testing Details

Smoke Testing using the below test script:

from crewai import LLM

API_KEY = "api-key"
ENDPOINT = "https://some-internal-name.openai.azure.com"
MODEL = "azure/gpt-5.4-mini"

llm = LLM(
    model=MODEL,
    api="responses",
    api_key=API_KEY,
    endpoint=ENDPOINT,
)

print("=== Basic call ===")
result = llm.call(messages=[{"role": "user", "content": "Say hello in one sentence."}])
print(result)

print("\n=== Reasoning (medium) ===")
llm_reason = LLM(
    model=MODEL,
    api="responses",
    api_key=API_KEY,
    endpoint=ENDPOINT,
    reasoning_effort="medium",
)
result = llm_reason.call(messages=[{"role": "user", "content": "What is 47 * 83?"}])
print(result)

print("\n=== Multi-turn conversation ===")
llm_chat = LLM(
    model=MODEL,
    api="responses",
    api_key=API_KEY,
    endpoint=ENDPOINT,
    auto_chain=True,
    store=True,
)
r1 = llm_chat.call(messages=[{"role": "user", "content": "My favorite color is blue. Remember this."}])
print(f"Turn 1: {r1}")
r2 = llm_chat.call(messages=[{"role": "user", "content": "What is my favorite color?"}])
print(f"Turn 2: {r2}")
llm_chat.reset_chain()

print("\nDone!")

Test Output:
image

@kunalk16 kunalk16 marked this pull request as ready for review April 1, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Add Responses API Support for Azure OpenAI Provider

1 participant