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 Provider Registry

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

Overview

Technique for validating and normalizing provider connection configurations, including URL scheme validation, hostname migration, and base URL derivation from provider names and custom endpoints.

Description

Provider Registry manages the connection configuration for AI providers. Given a provider name (e.g., openai, deepseek, volcengine, custom) and an optional base URL, the registry produces a normalized connection dict containing the provider name, source identifier, base URL (with /v1 suffix), and root URL (without /v1).

Key responsibilities:

  • URL validation: Rejects URLs with credentials, query parameters, or fragments; requires HTTP(S) scheme and hostname
  • Hostname migration: Migrates the old AICON hostname (api.aiconapi.me) to the new one (api.aicon-studio.com)
  • Base URL derivation: Appends /v1 to the root URL if no path is specified
  • Source resolution: Determines whether the source is aicon (managed), compatible, or the provider name itself
  • Config validation: Validates the model catalog configuration (models.json) for structural integrity, model uniqueness, and capability constraints

Usage

Use this principle when systems need to connect to multiple AI providers with different base URLs and configurations. Apply when URL normalization and validation are needed before establishing provider connections. Use when a model catalog configuration file must be validated at load time.

Theoretical Basis

# Abstract registry connection
def connection(provider, base_url=None):
    provider = provider.lower()
    value = (base_url or PROVIDERS[provider][1]).strip().rstrip('/')
    parts = urlsplit(value)
    validate_scheme(parts)  # must be http/https
    reject_credentials(parts)  # no username/password/query/fragment
    # Hostname migration
    if parts.hostname == 'api.aiconapi.me':
        parts = parts._replace(netloc='api.aicon-studio.com')
    root = build_root_url(parts)
    base = root + '/v1' if no_path else parts
    source = 'aicon' if is_aicon_host else ('compatible' if custom else provider)
    return {'provider': provider, 'source': source, 'base_url': base, 'root_url': root}

Practical Guide

  • Always validate URL scheme and reject credentials in URLs
  • Support hostname migration for legacy endpoints
  • Derive base_url with /v1 suffix; root_url without it
  • Cache configuration by file content to avoid re-parsing on every load
  • Validate model config: version, models array, unique (source, name) pairs, capability constraints

Related Pages

Implemented By

Page Connections

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