I can't call this azure openai api, i tried multiple things, tried debugging

aditya 0 Reputation points
2025-03-14T23:16:03.66+00:00

so i'm trying to call the api in this format
with the below format of .env

it always returns a 404 depoloyment not found from the azure api side, i tried lookiong for examples but still, no clear doc on how to use/call it

AZURE_OPENAI_ENDPOINT=https://{my_endpoint_name}.openai.azure.com
AZURE_OPENAI_KEY=xxxx
AZURE_OPENAI_DEPLOYMENT_NAME=Microsoft.CognitiveServicesOpenAI-{id}

  `${process.env.AZURE_OPENAI_ENDPOINT}/openai/deployments/${process.env.AZURE_OPENAI_DEPLOYMENT_NAME}/chat/completions?api-version=2024-05-01-preview`

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
{count} votes

1 answer

Sort by: Most helpful
  1. Manas Mohanty 13,340 Reputation points Moderator
    2025-03-18T14:50:55.5066667+00:00

    Hi aditya

    Deployment name

    It seems that you have not put deployment name correctly.

    Please change the below line

    AZURE_OPENAI_DEPLOYMENT_NAME=Microsoft.CognitiveServicesOpenAI-{id}
    

    to

    AZURE_OPENAI_DEPLOYMENT_NAME=<Toyourmodeldeploymentname> //For e.g GPT-35-turbo-16k
    

    Attached screenshot for model deployment name for reference.

    deploymentname API version

    Please use below API version instead of 2024-05-01-preview for chat completions, embeddings, speech/whisper, on your data, Dall-e, assistants, etc.

    2024-10-21 (GA)

    2025-02-01-preview

    Reference on Rest API calls

    Hope it fixes your rest Api calls now.

    Please don’t forget to Accept Answer and Yes for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.

    Thank you.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.