Implement generative AI and agentic solutions 2.1 Build generative applications by using Foundry
An app already uses the OpenAI Python client with the v1 endpoint of a Foundry resource…
Study guide skill: Deploy and consume LLMs, small models, code models, and multimodal models
Question B4-015
An app already uses the OpenAI Python client with the v1 endpoint of a Foundry resource (base_url ending in /openai/v1/). The team deploys a DeepSeek model sold by Azure in the same resource and wants to call it with the fewest code changes. What should they do?
Select one answer.
Answer: A
The v1 API supports chat completions calls to models from other providers, such as DeepSeek and Grok, that support the OpenAI v1 chat completions syntax, so the existing client only needs the new deployment name as model. The v1 GA API doesn't require an api-version parameter. The Anthropic SDK and endpoint are for Anthropic Claude models deployed in Foundry.
Deep dive
How it works
The v1 API of a Foundry resource changes how you call it with the OpenAI SDK:
- You use the OpenAI() client instead of AzureOpenAI(), with base_url set to the endpoint plus /openai/v1/ (both the openai.azure.com and services.ai.azure.com formats work).
- api-version is no longer a required parameter with the v1 GA API.
- Token refresh for Microsoft Entra ID is built into the OpenAI() client, so you no longer need AzureOpenAI() for it.
The v1 API isn't only for OpenAI models. Microsoft recommends the Responses API for OpenAI models, but the v1 API also allows chat completions calls with models from other providers, like DeepSeek and Grok, that support the OpenAI v1 chat completions syntax.
So the app keeps its OpenAI() client and base_url, and calls chat completions with model set to the DeepSeek deployment name. The SDK overview points the same way: use the OpenAI SDK when using Models sold by Azure through Chat Completions.
The other options, and when you'd use them
- Switch to AzureOpenAI with a dated api-version: The v1 API uses OpenAI() and doesn't require api-version. Going back to AzureOpenAI() adds changes instead of removing them.
- A separate Azure OpenAI resource: The v1 API already serves chat completions for providers like DeepSeek, from the same resource.
- Anthropic SDK and /anthropic endpoint: That's for Anthropic Claude models deployed in Foundry, not DeepSeek.
Exam tip
v1 endpoint = OpenAI() client, no api-version, and non-OpenAI models (DeepSeek, Grok) via chat completions by deployment name.
References
Last reviewed: