Class OpenRouterAiProvider
java.lang.Object
uno.anahata.asi.agi.event.BasicPropertyChangeSource
uno.anahata.asi.agi.provider.AbstractAiProvider
uno.anahata.asi.openai.compatible.OpenAiChatCompletionsProvider
uno.anahata.asi.openrouter.OpenRouterAiProvider
- All Implemented Interfaces:
PropertyChangeSource, Rebindable
Dedicated AI Provider for OpenRouter (openrouter.ai) using their OpenAI-compatible API.
Connects to https://openrouter.ai/api/v1 to access hundreds of models from
OpenAI, Anthropic, Google, Meta, DeepSeek, xAI (Grok), Mistral, and open-source communities.
Includes automated discovery of context lengths, provider output ceilings, pricing,
and multimodal capabilities directly from the /v1/models endpoint.
- Author:
- anahata
-
Field Summary
Fields inherited from class AbstractAiProvider
MARKUP_TABLE_HEADERFields inherited from class BasicPropertyChangeSource
propertyChangeSupport -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new OpenRouter provider with stable UUID "OpenRouter". -
Method Summary
Modifier and TypeMethodDescriptionprotected OpenAiCompatibleModelcreateModel(com.fasterxml.jackson.databind.JsonNode node) Constructs a concrete model instance for this provider.Gets a template or hint string to display when the API keys file is empty.Methods inherited from class OpenAiChatCompletionsProvider
createHttpClient, createRequestBuilder, isRetryable, listModelsMethods inherited from class AbstractAiProvider
addModel, addModels, ensureKeysFileExists, findModels, getAllDisplayModels, getAllSupportedActions, getCachedApiModel, getCurrentKey, getEnabledModels, getKeyPoolSize, getKeysAcquisitionUri, getKeysFilePath, getModel, getModels, getModelsDirectory, getProviderDirectory, getProviderId, getUnloadableModelsDirectory, hasKeys, hokusPocus, initialize, isEffectivelyEnabled, loadModelsFromDisk, persist, refreshCachedApiModels, reloadKeyPool, reloadKeyPoolIfNeeded, remove, removeModel, testConnection, toMarkupRow, toMarkupRowMethods inherited from class BasicPropertyChangeSource
addPropertyChangeListener, addPropertyChangeListener, rebind, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PropertyChangeSource
getPropertyChangeSupport
-
Constructor Details
-
OpenRouterAiProvider
public OpenRouterAiProvider()Constructs a new OpenRouter provider with stable UUID "OpenRouter".
-
-
Method Details
-
createModel
Constructs a concrete model instance for this provider.Instantiates an
OpenRouterModelcapable of extracting rich capability, pricing, and context limits from OpenRouter model metadata.- Overrides:
createModelin classOpenAiChatCompletionsProvider- Parameters:
node- The raw JSON model descriptor.- Returns:
- A configured
OpenRouterModelinstance.
-
getApiKeyHint
Gets a template or hint string to display when the API keys file is empty.Implementation details: Provides a standard header hint for the multi-key configuration file.
Provides the OpenRouter-specific API key format template.
- Overrides:
getApiKeyHintin classOpenAiChatCompletionsProvider- Returns:
- Multi-line template string.
-

