/openai/deployments/{deployment-id}/chat/completions?api-version=...) rather than the canonical /v1/chat/completions. The Cognisafe proxy handles this transparently — it forwards the request to the upstream URL you configure, preserving the path and query string. The only change required in your application code is setting base_url to the Cognisafe proxy.
The insertion pattern
Replace the Azure OpenAI endpoint with your Cognisafe proxy URL in your SDK or HTTP client configuration. The proxy rewrites nothing — it forwards the full path, including the deployment name andapi-version parameter, to the real Azure OpenAI endpoint configured as UPSTREAM_URL.
Environment variable mapping
The Cognisafe proxy does not strip or inspect the
api-version query parameter. Whatever your SDK sends is forwarded verbatim to Azure OpenAI. You are responsible for using an api-version that your Azure OpenAI resource supports.Python: Azure OpenAI SDK
Theopenai Python package supports Azure OpenAI via AzureOpenAI. Route it through Cognisafe by replacing azure_endpoint with the proxy URL and setting api_key to your PROXY_API_KEY.
Python: Cognisafe SDK (recommended)
The Cognisafe SDK’spatch_openai() function handles proxy routing automatically. For Azure OpenAI, set the standard Azure environment variables and configure the SDK before patching:
Azure OpenAI request path handling
Azure OpenAI endpoints follow this pattern:UPSTREAM_URL on the proxy deployment to your Azure OpenAI resource base URL — without a trailing slash and without the /openai/deployments/... path:
AAD token authentication (no static key)
Azure OpenAI supports authentication via Azure AD bearer tokens in addition to API keys. If your deployment policy prohibits static API keys on the Azure OpenAI resource, configure the proxy to use workload identity.Proxy workload identity setup (AKS)
Enable workload identity on the proxy pod (see the AKS blueprint for the full setup). The proxy needs a managed identity with the Cognitive Services User role on the Azure OpenAI resource:Authorization header on outbound requests to Azure OpenAI. The current Go proxy forwards the Authorization header from the incoming request. To use workload identity, implement token acquisition in the proxy using the Azure Identity SDK:
Private endpoint option
For zero-public-egress deployments, place both the Cognisafe proxy and the Azure OpenAI private endpoint in the same VNet. The proxy resolves<resource>.openai.azure.com via private DNS to the private endpoint IP — no traffic leaves the Microsoft backbone.

