Repository navigation
feat(containers): Azure routing, managed container IDs, delete response parsing #25287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
krrish-berri-2
merged 7 commits into
litellm_internal_staging_04_11_2026
from
litellm_azure-containers-delete-response-and-routing
Apr 11, 2026
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
60e6344
feat(containers): Azure container routing, managed IDs, and delete re…
Sameerlite 4d67738
fix(responses): gate response id update on parsed_chunk having response
Sameerlite 91cb235
feat(containers): encode container IDs in SDK responses for routing
Sameerlite 202ea11
fix(containers): module-level imports and managed cntr_ ID encoding
Sameerlite 084938d
fix(containers): decode managed IDs in endpoint_factory SDK path
Sameerlite c8e3da9
Fix p1 concern
Sameerlite 6843a93
Fix p1 concern
Sameerlite File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| from typing import Optional | ||
|
|
||
| from litellm.llms.azure.common_utils import BaseAzureLLM | ||
| from litellm.llms.openai.containers.transformation import OpenAIContainerConfig | ||
| from litellm.types.router import GenericLiteLLMParams | ||
|
|
||
|
|
||
| class AzureContainerConfig(OpenAIContainerConfig): | ||
| """ | ||
| Configuration class for Azure OpenAI container API. | ||
|
|
||
| Inherits request/response transformations from OpenAIContainerConfig since | ||
| Azure's container API is wire-compatible with OpenAI's. Only overrides | ||
| authentication (api-key header) and URL construction (openai/v1/containers path). | ||
|
|
||
| Azure container API reference: | ||
| https://learn.microsoft.com/en-us/azure/foundry/openai/latest#containers | ||
| """ | ||
|
|
||
| def validate_environment( | ||
| self, | ||
| headers: dict, | ||
| api_key: Optional[str] = None, | ||
| ) -> dict: | ||
| return BaseAzureLLM._base_validate_azure_environment( | ||
| headers=headers, | ||
| litellm_params=GenericLiteLLMParams(api_key=api_key), | ||
| ) | ||
|
|
||
| def get_complete_url( | ||
| self, | ||
| api_base: Optional[str], | ||
| litellm_params: dict, | ||
| ) -> str: | ||
| """ | ||
| Build the Azure container endpoint URL. | ||
|
|
||
| Azure container API uses the path: | ||
| {endpoint}/openai/v1/containers | ||
| when api_version is 'v1', 'latest', or 'preview'; otherwise: | ||
| {endpoint}/openai/containers | ||
| """ | ||
| return BaseAzureLLM._get_base_azure_url( | ||
| api_base=api_base, | ||
| litellm_params=litellm_params, | ||
| route="/openai/containers", | ||
| default_api_version="v1", | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| """Shared helpers for OpenAI-compatible container API URL construction.""" | ||
|
|
||
| import httpx | ||
|
|
||
|
|
||
| def join_container_api_base_path(api_base: str, path_suffix: str) -> str: | ||
| """Append ``path_suffix`` to the path of ``api_base``, keeping the query string last. | ||
|
|
||
| Azure (and some bases) pass ``api_base`` like | ||
| ``https://host/openai/v1/containers?api-version=v1``. Naive string concat would | ||
| produce ``...?api-version=v1/cntr_...`` which is invalid; this uses ``httpx.URL`` | ||
| so the result is ``.../containers/cntr_.../files?api-version=v1``. | ||
| """ | ||
| if not path_suffix.startswith("/"): | ||
| path_suffix = f"/{path_suffix}" | ||
| parsed = httpx.URL(api_base) | ||
| new_path = f"{parsed.path.rstrip('/')}{path_suffix}" | ||
| return str(parsed.copy_with(path=new_path)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.