Files
big-agi/AZURE_CONFIG.example
T
paulhshort 9fe5697fd4 Fix Azure OpenAI Resource Not Found errors for GPT-5 and o3 models (#828)
This commit addresses GitHub issue #828 by fixing URL construction for Azure OpenAI's Responses API
and preventing malformed URLs from client configuration issues.

## Problems Fixed:
1. Host normalization: Prevents malformed URLs when client config includes paths/queries
2. API paradigm support: Properly handles Azure's next-gen v1 Responses API
3. API version consistency: Centralizes version management with env overrides

## Key Changes:
- Normalize Azure host URLs to origin only (strip path/query)
- Prefer server environment variables over client-provided hosts
- Add special handling for Responses API (/openai/v1/responses)
- Support both traditional (deployment-based) and v1 API paradigms
- Add configurable API versions via environment variables
- Include debug logging for API paradigm selection

## New Environment Variables:
- AZURE_API_V1: Enable next-gen v1 API explicitly
- AZURE_RESPONSES_API_VERSION: Control Responses API version
- AZURE_CHAT_API_VERSION: Control Chat Completions API version
- AZURE_DEPLOYMENTS_API_VERSION: Control deployments listing API version

## Testing:
Validated with Azure OpenAI endpoint showing:
- List Deployments:  Works
- Chat Completions:  Works (with correct params for GPT-5)
- Responses API (v1):  Works with /openai/v1/responses?api-version=preview
- Responses API (traditional):  404 (Azure doesn't support this pattern)

The fix defaults to using Azure's recommended next-gen v1 API for Responses
while maintaining backward compatibility for existing deployments.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 19:37:41 -04:00

27 lines
1015 B
Plaintext

# Azure OpenAI Configuration Example
# Copy this to .env.local and update with your values
# Required: Your Azure OpenAI endpoint and key
AZURE_OPENAI_API_ENDPOINT=https://your-resource.openai.azure.com
AZURE_OPENAI_API_KEY=your-api-key-here
# Optional: API Configuration (defaults shown)
# Enable next-generation v1 API for Responses (recommended)
# AZURE_API_V1=true
# API Version for Responses endpoint
# Use 'preview' for next-gen v1 API (default and recommended)
# Use '2025-04-01-preview' for traditional deployment-based API
# AZURE_RESPONSES_API_VERSION=preview
# API Version for Chat Completions
# AZURE_CHAT_API_VERSION=2025-02-01-preview
# API Version for listing deployments
# AZURE_DEPLOYMENTS_API_VERSION=2023-03-15-preview
# Notes:
# - The default configuration uses next-gen v1 API for Responses
# - This is Azure's recommended approach for new implementations
# - Traditional deployment-based API is still used for chat/completions
# - All paths and query parameters are handled automatically