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

Principle:869413421 Ai moive studio Model Catalog Resolution

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

Overview

Technique for dynamically discovering available AI models, validating user permissions, and resolving logical model names to provider-specific configurations through a multi-layer catalog.

Description

Model Catalog Resolution is the process of determining which AI models a specific API key can access, what capabilities each model has, and resolving a user-requested model name to its full configuration. This involves three layers:

  • Public catalog: Site-wide model availability (pricing/availability data from the provider's public endpoint)
  • Permission catalog: Per-credential model access (what models this specific API key is authorized to use)
  • Configuration catalog: Server-side model configuration (from models.json) defining profiles, capabilities, and defaults

The resolution process intersects these three layers: a model must be configured, enabled, and permitted for the given key. The result is a model config dict containing the provider-specific ID, profile, aspect ratios, durations, resolutions, voices, and other capabilities.

Usage

Use this principle when building systems that need to dynamically discover and validate available AI models per user credential. Apply when different API keys have access to different model sets, and when model capabilities (aspect ratios, durations, voices) must be validated before generation calls.

Theoretical Basis

The resolution process:

# Abstract catalog resolution
async def resolve_model(connection, token, model, kind):
    catalog = await get_catalog(connection['provider'], connection['base_url'], token)
    candidates = [m for m in catalog['models'] if m['type'] == kind]
    if not model:
        model = catalog['defaults'].get(kind) or candidates[0]['id']
    for entry in catalog['models']:
        if entry['id'] == model and entry['type'] == kind:
            return entry  # contains id, profile, aspect_ratios, etc.
    raise ValueError('Model not available for this key')

Caching strategy:

  • Public catalog: 5-minute TTL
  • Permission catalog: 60-second TTL, keyed by SHA-256 of (URL + token)
  • Configuration catalog: content-addressed (cached by file content hash)

Practical Guide

  • Cache permission results per-credential with short TTL (60s)
  • Cache public catalog with longer TTL (5min) and serve stale on failure
  • Use SHA-256 hashing for cache keys to avoid plaintext credentials in memory
  • Validate that defaults reference enabled, available models
  • Include model capabilities (aspect_ratios, durations, resolutions, voices) in the resolved config

Related Pages

Implemented By

Page Connections

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