Documentation
¶
Overview ¶
Package openrouter provides a Genkit plugin for OpenRouter. OpenRouter provides a unified API to access various LLM providers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDefinedModel ¶
IsDefinedModel reports whether a model is defined.
Types ¶
type ModelDefinition ¶
type ModelDefinition struct {
// Name is an optional label for the model (e.g., "fast", "expensive").
// If provided, the model registers as "openrouter/{Name}" (e.g., "openrouter/fast").
// If empty, the first model in Models is used as the name (e.g., "openrouter/anthropic/claude-3-opus").
Name string
// Models is the list of OpenRouter model IDs to use, in order of preference.
// If multiple models are specified, OpenRouter will try them in order as fallbacks.
// At least one model must be specified.
Models []string
// Label is an optional human-readable label for display purposes.
Label string
}
ModelDefinition represents a model configuration.
type OpenRouter ¶
type OpenRouter struct {
// APIKey is the OpenRouter API key. If empty, reads from OPENROUTER_API_KEY env var.
APIKey string
// SiteName is an optional site name for OpenRouter analytics.
SiteName string
// SiteURL is an optional site URL for OpenRouter analytics.
SiteURL string
// contains filtered or unexported fields
}
OpenRouter provides configuration options for the plugin.
func (*OpenRouter) DefineModel ¶
func (o *OpenRouter) DefineModel(g *genkit.Genkit, model ModelDefinition, opts *ai.ModelOptions) ai.Model
DefineModel registers a model with Genkit.
Click to show internal directories.
Click to hide internal directories.