feat(providers): add superbot as an OpenAI-compatible provider

Registers superbot as a JSON-configured OpenAI-compatible provider (SUPERBOT_API_KEY, SUPERBOT_API_BASE), adds it to the Admin UI Add Model form and the endpoint support matrix, prices superbot/superbot and superbot/superbot-fast at the list prices on https://superbot.gg/pricing, and adds a mocked unit test.
This commit is contained in:
superbot 2026-10-20 00:12:20 -06:00
parent ba61ecdf57
commit 0d8653d3e8
9 changed files with 352 additions and 0 deletions

View file

@ -1051,6 +1051,7 @@ openai_compatible_endpoints: Final[list[str]] = [
"https://api.reka.ai/v1",
"https://gigachat.devices.sberbank.ru/api/v1",
"https://api.openinfer.ai/v1",
"https://api.superbot.gg/v1",
]
@ -1129,6 +1130,7 @@ openai_compatible_providers: Final[list[str]] = [
"prism",
"sail",
"reka",
"superbot",
]
OPENAI_AUDIO_TRANSCRIPTION_PROVIDERS: Final = frozenset({"openai"} | frozenset(openai_compatible_providers))

View file

@ -249,5 +249,10 @@
"/v1/responses",
"/v1/messages"
]
},
"superbot": {
"base_url": "https://api.superbot.gg/v1",
"api_key_env": "SUPERBOT_API_KEY",
"api_base_env": "SUPERBOT_API_BASE"
}
}

View file

@ -76119,6 +76119,34 @@
"supports_reasoning": true,
"source": "https://api.openinfer.ai/v1/models"
},
"superbot/superbot": {
"max_tokens": 65536,
"max_input_tokens": 1000000,
"max_output_tokens": 65536,
"input_cost_per_token": 1e-06,
"output_cost_per_token": 5e-06,
"cache_read_input_token_cost": 5e-08,
"cache_creation_input_token_cost": 1.25e-06,
"litellm_provider": "superbot",
"mode": "chat",
"supports_function_calling": true,
"supports_reasoning": true,
"source": "https://superbot.gg/pricing"
},
"superbot/superbot-fast": {
"max_tokens": 65536,
"max_input_tokens": 500000,
"max_output_tokens": 65536,
"input_cost_per_token": 1e-06,
"output_cost_per_token": 5e-06,
"cache_read_input_token_cost": 5e-08,
"cache_creation_input_token_cost": 1.25e-06,
"litellm_provider": "superbot",
"mode": "chat",
"supports_function_calling": true,
"supports_reasoning": true,
"source": "https://superbot.gg/pricing"
},
"xai/grok-voice-3.0": {
"input_cost_per_second": 0.001333333333333,
"input_cost_per_text_message": 0.004,

View file

@ -2207,6 +2207,24 @@
"interactions": false
}
},
"superbot": {
"display_name": "superbot (`superbot`)",
"url": "https://docs.litellm.ai/docs/providers/superbot",
"endpoints": {
"chat_completions": true,
"messages": true,
"responses": true,
"embeddings": false,
"image_generations": false,
"audio_transcriptions": false,
"audio_speech": false,
"moderations": false,
"batches": false,
"rerank": false,
"a2a": false,
"interactions": false
}
},
"snowflake": {
"display_name": "Snowflake (`snowflake`)",
"url": "https://docs.litellm.ai/docs/providers/snowflake",

View file

@ -3315,6 +3315,34 @@
],
"default_model_placeholder": "sail/openai/gpt-oss-120b"
},
{
"provider": "Superbot",
"provider_display_name": "superbot",
"litellm_provider": "superbot",
"credential_fields": [
{
"key": "api_base",
"label": "API Base",
"placeholder": "https://api.superbot.gg/v1",
"tooltip": null,
"required": false,
"field_type": "text",
"options": null,
"default_value": null
},
{
"key": "api_key",
"label": "API Key",
"placeholder": null,
"tooltip": null,
"required": true,
"field_type": "password",
"options": null,
"default_value": null
}
],
"default_model_placeholder": "superbot/superbot"
},
{
"provider": "Sambanova",
"provider_display_name": "Sambanova",

View file

@ -4534,6 +4534,7 @@ class LlmProviders(str, Enum):
META = "meta"
SAIL = "sail"
REKA = "reka"
SUPERBOT = "superbot"
LITELLM_AGENT = "litellm_agent"
CURSOR = "cursor"
BEDROCK_MANTLE = "bedrock_mantle"

View file

@ -76119,6 +76119,34 @@
"supports_reasoning": true,
"source": "https://api.openinfer.ai/v1/models"
},
"superbot/superbot": {
"max_tokens": 65536,
"max_input_tokens": 1000000,
"max_output_tokens": 65536,
"input_cost_per_token": 1e-06,
"output_cost_per_token": 5e-06,
"cache_read_input_token_cost": 5e-08,
"cache_creation_input_token_cost": 1.25e-06,
"litellm_provider": "superbot",
"mode": "chat",
"supports_function_calling": true,
"supports_reasoning": true,
"source": "https://superbot.gg/pricing"
},
"superbot/superbot-fast": {
"max_tokens": 65536,
"max_input_tokens": 500000,
"max_output_tokens": 65536,
"input_cost_per_token": 1e-06,
"output_cost_per_token": 5e-06,
"cache_read_input_token_cost": 5e-08,
"cache_creation_input_token_cost": 1.25e-06,
"litellm_provider": "superbot",
"mode": "chat",
"supports_function_calling": true,
"supports_reasoning": true,
"source": "https://superbot.gg/pricing"
},
"xai/grok-voice-3.0": {
"input_cost_per_second": 0.001333333333333,
"input_cost_per_text_message": 0.004,

View file

@ -2479,6 +2479,24 @@
"interactions": false
}
},
"superbot": {
"display_name": "superbot (`superbot`)",
"url": "https://docs.litellm.ai/docs/providers/superbot",
"endpoints": {
"chat_completions": true,
"messages": true,
"responses": true,
"embeddings": false,
"image_generations": false,
"audio_transcriptions": false,
"audio_speech": false,
"moderations": false,
"batches": false,
"rerank": false,
"a2a": false,
"interactions": false
}
},
"snowflake": {
"display_name": "Snowflake (`snowflake`)",
"url": "https://docs.litellm.ai/docs/providers/snowflake",

View file

@ -0,0 +1,224 @@
import json
from pathlib import Path
from typing import Final
import pytest
import respx
import litellm
from litellm.caching.llm_caching_handler import LLMClientCache
# Stand-in credentials for the mocked upstream. They are not real keys.
EXPLICIT_CREDENTIAL: Final = "explicit-credential-for-tests"
ENV_CREDENTIAL: Final = "env-credential-for-tests"
_CHAT_COMPLETION: Final = {
"id": "chatcmpl_superbot",
"object": "chat.completion",
"created": 1_790_000_000,
"model": "superbot",
"choices": [
{
"index": 0,
"message": {"role": "assistant", "content": "Hello from superbot"},
"finish_reason": "stop",
}
],
"usage": {"prompt_tokens": 4, "completion_tokens": 3, "total_tokens": 7},
}
def test_superbot_is_a_registered_provider():
assert litellm.LlmProviders.SUPERBOT.value == "superbot"
assert "superbot" in litellm.provider_list
assert "superbot" in litellm.constants.openai_compatible_providers
def test_superbot_provider_resolution(monkeypatch: pytest.MonkeyPatch):
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
monkeypatch.setenv("SUPERBOT_API_KEY", ENV_CREDENTIAL)
model, provider, resolved_key, api_base = get_llm_provider(
model="superbot/superbot-fast",
custom_llm_provider=None,
api_base=None,
api_key=None,
)
assert model == "superbot-fast"
assert provider == "superbot"
assert resolved_key == ENV_CREDENTIAL
assert api_base == "https://api.superbot.gg/v1"
def test_superbot_provider_keeps_explicit_credentials(monkeypatch: pytest.MonkeyPatch):
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
monkeypatch.setenv("SUPERBOT_API_KEY", ENV_CREDENTIAL)
monkeypatch.setenv("SUPERBOT_API_BASE", "https://superbot.env.example/v1")
_, provider, resolved_key, api_base = get_llm_provider(
model="superbot/superbot",
custom_llm_provider=None,
api_base="https://superbot.internal.example/v1",
api_key=EXPLICIT_CREDENTIAL,
)
assert provider == "superbot"
assert resolved_key == EXPLICIT_CREDENTIAL
assert api_base == "https://superbot.internal.example/v1"
def test_superbot_api_base_env_overrides_default(monkeypatch: pytest.MonkeyPatch):
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
monkeypatch.setenv("SUPERBOT_API_KEY", ENV_CREDENTIAL)
monkeypatch.setenv("SUPERBOT_API_BASE", "https://superbot.env.example/v1")
_, provider, _, api_base = get_llm_provider(
model="superbot/superbot",
custom_llm_provider=None,
api_base=None,
api_key=None,
)
assert provider == "superbot"
assert api_base == "https://superbot.env.example/v1"
def test_superbot_api_base_autodetects_provider(monkeypatch: pytest.MonkeyPatch):
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
monkeypatch.setenv("SUPERBOT_API_KEY", ENV_CREDENTIAL)
model, provider, resolved_key, api_base = get_llm_provider(
model="superbot",
custom_llm_provider=None,
api_base="https://api.superbot.gg/v1",
api_key=None,
)
assert model == "superbot"
assert provider == "superbot"
assert resolved_key == ENV_CREDENTIAL
assert api_base == "https://api.superbot.gg/v1"
def test_superbot_is_available_in_add_model_form():
fields_path = Path(litellm.__file__).parent / "proxy" / "public_endpoints" / "provider_create_fields.json"
providers = json.loads(fields_path.read_text())
superbot = next(provider for provider in providers if provider["litellm_provider"] == "superbot")
assert superbot["provider"] == "Superbot"
assert superbot["provider_display_name"] == "superbot"
assert superbot["default_model_placeholder"] == "superbot/superbot"
assert {field["key"]: field["required"] for field in superbot["credential_fields"]} == {
"api_base": False,
"api_key": True,
}
def test_superbot_supported_endpoints():
expected: Final = {
"chat_completions": True,
"messages": True,
"responses": True,
"embeddings": False,
"image_generations": False,
"audio_transcriptions": False,
"audio_speech": False,
"moderations": False,
"batches": False,
"rerank": False,
"a2a": False,
"interactions": False,
}
backup_path = Path(litellm.__file__).parent / "provider_endpoints_support_backup.json"
root_path = Path(litellm.__file__).parent.parent / "provider_endpoints_support.json"
assert json.loads(backup_path.read_text())["providers"]["superbot"]["endpoints"] == expected
assert json.loads(root_path.read_text())["providers"]["superbot"]["endpoints"] == expected
@pytest.mark.parametrize(
"model_id, context",
[("superbot/superbot", 1_000_000), ("superbot/superbot-fast", 500_000)],
)
def test_superbot_models_are_priced_in_both_cost_maps(model_id: str, context: int):
root = Path(litellm.__file__).parent.parent
maps: Final = [
root / "model_prices_and_context_window.json",
Path(litellm.__file__).parent / "model_prices_and_context_window_backup.json",
]
for path in maps:
row = json.loads(path.read_text())[model_id]
assert row["litellm_provider"] == "superbot"
assert row["mode"] == "chat"
assert row["max_input_tokens"] == context
assert row["max_output_tokens"] == 65_536
assert row["input_cost_per_token"] == pytest.approx(1.0e-6)
assert row["output_cost_per_token"] == pytest.approx(5.0e-6)
assert row["cache_read_input_token_cost"] == pytest.approx(5.0e-8)
assert row["cache_creation_input_token_cost"] == pytest.approx(1.25e-6)
assert row["supports_function_calling"] is True
def test_superbot_chat_completion_request():
with respx.mock() as upstream:
route: Final = upstream.post("https://api.superbot.gg/v1/chat/completions").respond(200, json=_CHAT_COMPLETION)
response: Final = litellm.completion(
model="superbot/superbot",
messages=[{"role": "user", "content": "Say hello"}],
api_key=EXPLICIT_CREDENTIAL,
)
request: Final = route.calls.last.request
body: Final = json.loads(request.content)
assert route.call_count == 1
assert str(request.url) == "https://api.superbot.gg/v1/chat/completions"
assert request.headers["authorization"] == f"Bearer {EXPLICIT_CREDENTIAL}"
assert body["model"] == "superbot"
assert body["messages"] == [{"role": "user", "content": "Say hello"}]
assert response.choices[0].message.content == "Hello from superbot"
def test_superbot_responses_request_is_bridged_to_chat_completions():
with respx.mock() as upstream:
route: Final = upstream.post("https://api.superbot.gg/v1/chat/completions").respond(200, json=_CHAT_COMPLETION)
response: Final = litellm.responses(
model="superbot/superbot",
input="Say hello",
api_key=EXPLICIT_CREDENTIAL,
)
request: Final = route.calls.last.request
body: Final = json.loads(request.content)
assert route.call_count == 1
assert request.headers["authorization"] == f"Bearer {EXPLICIT_CREDENTIAL}"
assert body["model"] == "superbot"
assert body["messages"] == [{"role": "user", "content": "Say hello"}]
assert response.output[0].content[0].text == "Hello from superbot"
@pytest.mark.asyncio
async def test_superbot_anthropic_messages_request_is_bridged_to_chat_completions(monkeypatch: pytest.MonkeyPatch):
monkeypatch.setattr(litellm, "disable_aiohttp_transport", True)
monkeypatch.setattr(litellm, "in_memory_llm_clients_cache", LLMClientCache())
with respx.mock() as upstream:
route: Final = upstream.post("https://api.superbot.gg/v1/chat/completions").respond(200, json=_CHAT_COMPLETION)
response: Final = await litellm.anthropic.messages.acreate(
model="superbot/superbot",
messages=[{"role": "user", "content": "Say hello"}],
max_tokens=32,
api_key=EXPLICIT_CREDENTIAL,
)
request: Final = route.calls.last.request
body: Final = json.loads(request.content)
assert route.call_count == 1
assert request.headers["authorization"] == f"Bearer {EXPLICIT_CREDENTIAL}"
assert body["model"] == "superbot"
assert body["messages"] == [{"role": "user", "content": "Say hello"}]
assert body["max_tokens"] == 32
assert response["content"][0]["text"] == "Hello from superbot"