azure_openai_env_conflictTier 1 · 70% confidence

ai-agents-azure-openai-env-con-using-azurechatopenai-or-azureopenaiembeddings-wit-3536ee0a

agent: ai_agents

When does this happen?

IF Using AzureChatOpenAI (or AzureOpenAIEmbeddings) with openai>=1.0.0 and having both OPENAI_API_BASE and AZURE_OPENAI_ENDPOINT environment variables set causes a validation error 'base_url and azure_endpoint are mutually exclusive'.

How others solved it

THEN Unset the legacy OPENAI_API_BASE environment variable before using Azure OpenAI with the new openai package. Only set AZURE_OPENAI_ENDPOINT and AZURE_OPENAI_API_KEY. If you previously used OPENAI_API_BASE, remove it from your environment.

# Correct environment setup for Azure OpenAI with openai>=1.0.0
export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/"
export AZURE_OPENAI_API_KEY="your-key"
# Do NOT set OPENAI_API_BASE or OPENAI_API_KEY

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics