Jido.AI.Provider.OpenRouter (Jido AI v0.5.2)
View SourceAdapter for the OpenRouter AI provider.
Implements the ProviderBehavior for OpenRouter's specific API.
Summary
Functions
Builds a %Jido.AI.Model{} struct from the provided options.
Lists available models from local cache or API.
Fetches a specific model by ID from the API or cache.
Returns a list of models for the provider.
Normalizes a model ID to ensure it's in the correct format for OpenRouter.
Functions
Builds a %Jido.AI.Model{} struct from the provided options.
This function validates the options, sets defaults, and creates a fully populated model struct for the OpenRouter provider.
Parameters
- opts: Keyword list of options for building the model
Returns
- } on success
- on failure
Lists available models from local cache or API.
Options
- refresh: boolean - Whether to force refresh from API (default: false)
- api_key: string - OpenRouter API key (optional)
Returns a tuple with {:ok, models} on success or {:error, reason} on failure.
Fetches a specific model by ID from the API or cache.
Options
- refresh: boolean - Whether to force refresh from API (default: false)
- api_key: string - OpenRouter API key (optional)
Returns a tuple with {:ok, model} on success or {:error, reason} on failure.
Returns a list of models for the provider.
This is a required function for the Provider.Adapter behaviour.
Normalizes a model ID to ensure it's in the correct format for OpenRouter.
Options
- No specific options for this method
Returns a tuple with {:ok, normalized_id} on success or {:error, reason} on failure.