Repository navigation
Add Inception provider #29522
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
Sameerlite
merged 4 commits into
BerriAI:litellm_oss_staging_030626
from
yanismiraoui:adding_inception_provider
Jun 3, 2026
Merged
Add Inception provider #29522
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
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
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
Empty file.
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,54 @@ | ||
| """ | ||
| Translate from OpenAI's `/v1/chat/completions` to Inception's `/v1/chat/completions` | ||
|
|
||
| Inception Labs (https://www.inceptionlabs.ai) serves the Mercury family of | ||
| diffusion LLMs through an OpenAI-compatible API, so we only need to point the | ||
| OpenAI-like handler at the Inception API base and pick up the Inception API key. | ||
| """ | ||
|
|
||
| from typing import List, Optional, Tuple | ||
|
|
||
| import litellm | ||
| from litellm.secret_managers.main import get_secret_str | ||
|
|
||
| from ...openai_like.chat.transformation import OpenAILikeChatConfig | ||
|
|
||
|
|
||
| class InceptionChatConfig(OpenAILikeChatConfig): | ||
| """ | ||
| Inception is OpenAI-compatible with standard endpoints | ||
| """ | ||
|
|
||
| @property | ||
| def custom_llm_provider(self) -> Optional[str]: | ||
| return "inception" | ||
|
|
||
| def get_supported_openai_params(self, model: str) -> List: | ||
| return [ | ||
| "max_tokens", | ||
| "max_completion_tokens", | ||
| "temperature", | ||
| "stop", | ||
| "tools", | ||
| "tool_choice", | ||
| "stream", | ||
| "stream_options", | ||
| "response_format", | ||
| "reasoning_effort", | ||
| "reasoning_summary", | ||
| "reasoning_summary_wait", | ||
| "diffusing", | ||
| "realtime", | ||
| ] | ||
|
|
||
| def _get_openai_compatible_provider_info( | ||
| self, api_base: Optional[str], api_key: Optional[str] | ||
| ) -> Tuple[Optional[str], Optional[str]]: | ||
| passed_api_base = api_base | ||
| api_base = api_base or get_secret_str("INCEPTION_API_BASE") or "https://api.inceptionlabs.ai/v1" # type: ignore | ||
|
veria-ai[bot] marked this conversation as resolved.
Resolved
|
||
| dynamic_api_key = api_key | ||
| if passed_api_base is None or api_key: | ||
| dynamic_api_key = ( | ||
| api_key or litellm.inception_key or get_secret_str("INCEPTION_API_KEY") | ||
| ) | ||
| return api_base, dynamic_api_key | ||
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,43 @@ | ||
| """ | ||
| Inception fill-in-the-middle (FIM) completions. | ||
|
|
||
| Inception's FIM endpoint is OpenAI text-completion compatible: it takes a | ||
| `prompt` (prefix) plus an optional `suffix` and returns standard | ||
| `choices[].text`. It is served at `/v1/fim/completions` rather than | ||
| `/v1/completions`, so routing points the OpenAI client at the `/v1/fim` base | ||
| (see the `text-completion-inception` branch in `main.py`). | ||
| """ | ||
|
|
||
| from typing import List | ||
|
|
||
| from litellm.llms.openai.completion.transformation import OpenAITextCompletionConfig | ||
|
|
||
|
|
||
| class InceptionTextCompletionConfig(OpenAITextCompletionConfig): | ||
| def get_supported_openai_params(self, model: str) -> List: | ||
| return [ | ||
| "suffix", | ||
| "max_tokens", | ||
| "max_completion_tokens", | ||
| "top_p", | ||
| "frequency_penalty", | ||
| "presence_penalty", | ||
| "stop", | ||
| "stream", | ||
| "stream_options", | ||
| ] | ||
|
|
||
| def map_openai_params( | ||
| self, | ||
| non_default_params: dict, | ||
| optional_params: dict, | ||
| model: str, | ||
| drop_params: bool, | ||
| ) -> dict: | ||
| supported_params = self.get_supported_openai_params(model) | ||
| for param, value in non_default_params.items(): | ||
| if param == "max_completion_tokens": | ||
| optional_params["max_tokens"] = value | ||
| elif param in supported_params: | ||
| optional_params[param] = value | ||
| return optional_params |
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.