class LittleGhost::DefaultModelRegistry
Supplies LittleGhost’s ready-to-use model selection. The registry maps the default role to GPT-5.6 Terra on OpenRouter or OpenAI and keeps the selected provider stable for its runtime.
Prefixed credentials take precedence over conventional provider variables:
-
LITTLEGHOST_OPENROUTER_API_KEY -
LITTLEGHOST_OPENAI_API_KEY -
OPENROUTER_API_KEY -
OPENAI_API_KEY
Blank values are ignored. Resolving the default role requires one supported key and raises ConfigurationError with the available choices otherwise. The environment is read when the registry is created, so build a new Runtime after changing credentials. Configure a ModelRegistry explicitly when the application needs another provider, model, or logical role.
Warning: Setting any supported key authorizes LittleGhost to send model inputs, including prompts, conversation history, tool data, and attachments, to the selected external provider. When more than one key is present, the precedence above determines that destination. Applications with provider or data-residency requirements should configure a ModelRegistry explicitly.
Public Class Methods
Source
# File lib/little_ghost/default_model_registry.rb, line 49 def initialize super variable, provider_name = CREDENTIALS.find { |name, _provider| !ENV[name].to_s.strip.empty? } if variable api_key = ENV.fetch(variable) provider_class = PROVIDERS.fetch(provider_name) provider(provider_name) do |model:, **| provider_class.new(api_key:, model:) end profile("default", provider: provider_name, model: MODELS.fetch(provider_name)) else configure_missing_credential end end
Selects one provider from the current environment and registers the default profile. The selection remains fixed for this registry instance.