Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions livekit-plugins/livekit-plugins-inception/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Inception AI plugin for LiveKit Agents

Support for Inception AI LLM models (e.g. `mercury-2` diffusion model) with LiveKit.

## Installation

```bash
pip install livekit-plugins-inception
```

## Pre-requisites

You'll need an API key from Inception AI. It can be set as an environment variable: `INCEPTION_API_KEY`

## Usage

### LLM

```python
from livekit.plugins import inception

llm = inception.LLM(model="mercury-2")
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2026 LiveKit, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Inception AI plugin for LiveKit Agents

See https://docs.livekit.io/agents/integrations/inception/ for more information.
"""

from .llm import LLM as LLM
from .log import logger
from .version import __version__ as __version__

__all__ = ["LLM", "__version__"]

from livekit.agents import Plugin


class InceptionPlugin(Plugin):
def __init__(self) -> None:
super().__init__(__name__, __version__, __package__, logger)


Plugin.register_plugin(InceptionPlugin())

# Cleanup docs of unexported modules
_module = dir()
NOT_IN_ALL = [m for m in _module if m not in __all__]

__pdoc__ = {}

for n in NOT_IN_ALL:
__pdoc__[n] = False
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Copyright 2026 LiveKit, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

import os

import httpx
import openai
from openai.types import ReasoningEffort

from livekit.agents.llm import ToolChoice
from livekit.agents.types import (
NOT_GIVEN,
NotGivenOr,
)
from livekit.agents.utils import is_given
from livekit.plugins.openai import LLM as OpenAILLM

from .models import LLMModels


class LLM(OpenAILLM):
def __init__(
self,
*,
model: str | LLMModels = "mercury-2",
api_key: NotGivenOr[str] = NOT_GIVEN,
user: NotGivenOr[str] = NOT_GIVEN,
safety_identifier: NotGivenOr[str] = NOT_GIVEN,
prompt_cache_key: NotGivenOr[str] = NOT_GIVEN,
temperature: NotGivenOr[float] = NOT_GIVEN,
top_p: NotGivenOr[float] = NOT_GIVEN,
parallel_tool_calls: NotGivenOr[bool] = NOT_GIVEN,
tool_choice: NotGivenOr[ToolChoice] = NOT_GIVEN,
base_url: NotGivenOr[str] = "https://api.inceptionlabs.ai/v1",
metadata: NotGivenOr[dict[str, str]] = NOT_GIVEN,
max_completion_tokens: NotGivenOr[int] = NOT_GIVEN,
reasoning_effort: NotGivenOr[ReasoningEffort] = NOT_GIVEN,
service_tier: NotGivenOr[str] = NOT_GIVEN,
timeout: httpx.Timeout | None = None,
max_retries: NotGivenOr[int] = NOT_GIVEN,
client: openai.AsyncClient | None = None,
):
"""Create a new instance of Inception AI LLM.

``api_key`` must be set to your Inception AI API key, either using the argument or by setting
the ``INCEPTION_API_KEY`` environmental variable.
"""
super().__init__(
model=model,
api_key=_get_api_key(api_key),
base_url=base_url,
client=client,
user=user,
safety_identifier=safety_identifier,
prompt_cache_key=prompt_cache_key,
temperature=temperature,
top_p=top_p,
parallel_tool_calls=parallel_tool_calls,
tool_choice=tool_choice,
reasoning_effort=reasoning_effort,
service_tier=service_tier,
timeout=timeout,
max_retries=max_retries,
metadata=metadata,
max_completion_tokens=max_completion_tokens,
)

@property
def provider(self) -> str:
return "InceptionAI"


def _get_api_key(key: NotGivenOr[str]) -> str:
inception_api_key = key if is_given(key) else os.environ.get("INCEPTION_API_KEY")
if not inception_api_key:
raise ValueError(
"INCEPTION_API_KEY is required, either as argument or set INCEPTION_API_KEY environmental variable" # noqa: E501
)
return inception_api_key
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Simple logger for the plugin
import logging

logger = logging.getLogger("livekit.plugins.inception")
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from typing import Literal

LLMModels = Literal[
"mercury-2",
"mercury-edit-2",
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Marker file for PEP 561.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2026 LiveKit, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "1.6.0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Plugin version 1.6.0 is behind the rest of the ecosystem at 1.6.1

The inception plugin's version.py sets __version__ = "1.6.0" while all other recently-created plugins (Cerebras, Groq, etc.) and livekit-agents itself are at 1.6.1. Per CONTRIBUTING.md, versions are managed by a bot before release, so this likely gets fixed automatically. However, if this plugin were published as-is, it would be the only 1.6.0 package in the ecosystem while depending on livekit-agents[openai]>=1.6.1.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

42 changes: 42 additions & 0 deletions livekit-plugins/livekit-plugins-inception/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "livekit-plugins-inception"
dynamic = ["version"]
description = "Agent Framework plugin for Inception AI LLM models."
readme = "README.md"
license = "Apache-2.0"
requires-python = ">=3.10.0"
authors = [{ name = "LiveKit", email = "hello@livekit.io" }]
keywords = ["webrtc", "realtime", "audio", "video", "livekit", "inception", "llm"]
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Topic :: Multimedia :: Sound/Audio",
"Topic :: Multimedia :: Video",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3 :: Only",
]
dependencies = ["livekit-agents[openai]>=1.6.1"]

[project.urls]
Documentation = "https://docs.livekit.io"
Website = "https://livekit.io/"
Source = "https://github.com/livekit/agents"

[tool.hatch.version]
path = "livekit/plugins/inception/version.py"

[tool.hatch.build.targets.wheel]
packages = ["livekit"]

[tool.hatch.build.targets.sdist]
include = ["/livekit"]

[tool.uv]
exclude-newer = "7 days"
exclude-newer-package = { livekit-agents = "0 days" }
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ livekit-plugins-gladia = { workspace = true }
livekit-plugins-gnani = { workspace = true }
livekit-plugins-google = { workspace = true }
livekit-plugins-groq = { workspace = true }
livekit-plugins-inception = { workspace = true }
livekit-plugins-hedra = { workspace = true }
livekit-plugins-hamming = { workspace = true }
livekit-plugins-hume = { workspace = true }
Expand Down
35 changes: 35 additions & 0 deletions tests/test_plugin_inception.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Tests for Inception AI LLM plugin configuration and behavior."""

from __future__ import annotations

import pytest

from livekit.plugins.inception import LLM

# Let's write the test cleanly.
pytestmark = pytest.mark.plugin("inception")


def test_default_model_and_base_url(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("INCEPTION_API_KEY", "test-key")
llm = LLM()
assert llm.model == "mercury-2"
# AsyncClient stores the configured base URL on _base_url.
assert str(llm._client.base_url).startswith("https://api.inceptionlabs.ai/v1")


def test_missing_api_key_raises(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.delenv("INCEPTION_API_KEY", raising=False)
with pytest.raises(ValueError, match="INCEPTION_API_KEY"):
LLM()


def test_provider_name(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("INCEPTION_API_KEY", "test-key")
assert (
LLM().provider == "InceptionAI"
) # In our class we returned super().provider which is "OpenAI" or did we override it? Let's check!
# Wait, did our LLM override provider?
# In services.py of groq, LLM does NOT override provider. It inherits OpenAILLM. But wait! OpenAILLM.provider is "openai".
# Wait, let's check what Groq LLM returns for provider, or what Cerebras LLM returns.
# Let's check if OpenAILLM has a provider property we should override.
11 changes: 11 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading