Skip to content

CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.

feat(catalog): ProviderPreset / ModelPreset / AuthSpec / WireApi

xf gongb4587600afff
diff --git a/cubepi/providers/catalog/__init__.py b/cubepi/providers/catalog/__init__.py
new file mode 100644
index 0000000..db2a949
--- /dev/null
+++ b/cubepi/providers/catalog/__init__.py
@@ -0,0 +1,4 @@
+"""Provider preset catalog.
+
+See docs/dev/specs/2026-05-19-llm-provider-platform-design.md §3.6.
+"""
diff --git a/cubepi/providers/catalog/types.py b/cubepi/providers/catalog/types.py
new file mode 100644
index 0000000..90c0b6b
--- /dev/null
+++ b/cubepi/providers/catalog/types.py
@@ -0,0 +1,48 @@
+"""Catalog types: ProviderPreset, ModelPreset, AuthSpec, WireApi."""
+
+from __future__ import annotations
+
+from typing import Literal
+
+from pydantic import BaseModel, Field
+
+from cubepi.providers.capability import CapabilityDescriptor
+
+WireApi = Literal["anthropic-messages", "openai-completions", "openai-responses"]
+
+
+class AuthSpec(BaseModel):
+ mode: Literal["api_key", "bearer", "none", "oauth", "iam"]
+ header_name: str | None = None
+ header_prefix: str | None = "Bearer "
+
+
+class ModelPreset(BaseModel):
+ model_id: str
+ display_name: str
+ context_window: int
+ max_tokens: int
+ input_modalities: list[str]
+ reasoning: bool = False
+
+
+class ProviderPreset(BaseModel):
+ slug: str
+ display_name: str
+ short_name: str
+ category: Literal["saas", "oss-framework", "custom"]
+ description: str
+ # @lobehub/icons provider id (lowercase, e.g. "anthropic", "openai",
+ # "deepseek"). cubebox frontend renders via
+ # <ProviderIcon provider={preset.logo} size=28 type="color" />.
+ # None = render generic fallback. Spec §3.6, §7 Q5.
+ logo: str | None = None
+
+ api: WireApi
+ base_url: str
+ auth: AuthSpec
+
+ capability: CapabilityDescriptor
+ model_capability_overrides: dict[str, CapabilityDescriptor] = Field(default_factory=dict)
+
+ default_models: list[ModelPreset] = Field(default_factory=list)
diff --git a/tests/test_catalog.py b/tests/test_catalog.py
new file mode 100644
index 0000000..2ac558c
--- /dev/null
+++ b/tests/test_catalog.py
@@ -0,0 +1,40 @@
+from cubepi.providers.catalog.types import (
+ AuthSpec, ModelPreset, ProviderPreset, WireApi,
+)
+from cubepi.providers.capability import CapabilityDescriptor, TemperatureSpec
+
+
+def test_wire_api_values():
+ assert WireApi.__args__ == ("anthropic-messages", "openai-completions", "openai-responses")
+
+
+def test_minimal_provider_preset_constructs():
+ p = ProviderPreset(
+ slug="custom-openai",
+ display_name="Custom OpenAI",
+ short_name="Custom",
+ category="custom",
+ description="",
+ api="openai-completions",
+ base_url="https://example.com/v1",
+ auth=AuthSpec(mode="api_key"),
+ capability=CapabilityDescriptor(),
+ default_models=[],
+ )
+ assert p.slug == "custom-openai"
+ assert p.model_capability_overrides == {}
+ assert p.logo is None # custom presets default to no brand mark
+
+
+def test_model_preset_minimal():
+ m = ModelPreset(
+ model_id="gpt-4o", display_name="GPT-4o",
+ context_window=128000, max_tokens=16384,
+ input_modalities=["text", "image"],
+ )
+ assert m.reasoning is False
+
+
+def test_auth_spec_api_key_defaults():
+ a = AuthSpec(mode="api_key")
+ assert a.header_name in (None, "Authorization")