Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:869413421 Ai moive studio Catalog Get Catalog

From Leeroopedia
Knowledge Sources
Domains Architecture, Generative_AI
Last Updated 2026-10-23 12:00 GMT

Overview

Function that discovers available AI models for a provider by intersecting public catalog, per-credential permissions, and server-side configuration with caching.

Description

'catalog.get_catalog builds a full model catalog for a provider/credential:

1. permitted_models: Queries the provider's /models endpoint to get models authorized for this API key (60s cache, SHA-256 keyed) 2. public_catalog: Queries the provider's /api/pricing endpoint for site-wide availability (5min cache, serves stale on failure) 3. selected_models: Loads server-side config from models.json 4. Intersection: A model is shown if it is configured, enabled, and available (or include_hidden is set)

Returns a dict with models (list of configs), stale (bool), defaults, and base_url.

Usage

Import when discovering available models for a provider. Called by resolve_model and the API key management UI.

Code Reference

Source Location

  • Repository: ai-moive-studio
  • File: backend/src/services/provider/catalog.py:L66-87

Signature

async def get_catalog(
    provider: str,
    base_url: str,
    token: str,
    refresh: bool = False,
    include_hidden: bool = False
) -> Dict:
    """
    Args:
        provider: provider name
        base_url: base URL
        token: API key
        refresh: bypass cache
        include_hidden: include unavailable models

    Returns:
        Dict with models, stale, defaults, base_url
    """

Import

from src.services.provider.catalog import get_catalog

I/O Contract

Inputs

Name Type Required Description
provider str Yes Provider name
base_url str Yes Base URL
token str Yes API key
refresh bool No Bypass cache (default False)
include_hidden bool No Include unavailable models (default False)

Outputs

Name Type Description
return value dict {models: list, stale: bool, defaults: dict, base_url: str}

Usage Examples

Discovering Available Models

from src.services.provider.catalog import get_catalog

catalog = await get_catalog("openai", "https://api.openai.com/v1", "sk-...")
for model in catalog["models"]:
    print(f"{model['id']}: {model['type']} - {model['status']}")

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment