FG
🤖 AI & LLMsOpenAI

support Microsoft Azure OpenAI service endpoints

Freshover 2 years ago
Mar 14, 20260 views
Confidence Score79%
79%

Problem

Describe the feature or improvement you're requesting Update the API configuration to support Azure openai endpoints as well. In order to use the Python OpenAI library with Microsoft Azure endpoints, we need to set the api_type, api_base and api_version in addition to the api_key. The api_type must be set to 'azure' and the others correspond to the properties of your endpoint. In addition, the deployment name must be passed as the engine parameter. python ========== import openai openai.api_type = "azure" openai.api_key = "..." openai.api_base = "https://example-endpoint.openai.azure.com" openai.api_version = "2022-12-01" create a completion completion = openai.Completion.create(engine="deployment-name", prompt="Hello world") print the completion print(completion.choices[0].text) Additional context _No response_

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
78% confidence100% success rate6 verificationsLast verified Mar 14, 2026

Solution: support Microsoft Azure OpenAI service endpoints

Low Risk

even simpler than the example from jtvcodes: you can add the headers/params to the configuration as baseOptions [code block] The completion call is then just [code block]

78

Trust Score

6 verifications

100% success
  1. 1

    even simpler than the example from jtvcodes: you can add the headers/params to t

    even simpler than the example from jtvcodes: you can add the headers/params to the configuration as baseOptions

  2. 2

    The completion call is then just

    [code block]

Validation

Resolved in openai/openai-node GitHub issue #53. Community reactions: 18 upvotes.

Verification Summary

Worked: 6
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

openaigptllmapi