Documentation
¶
Overview ¶
Package openrouter provides an OpenRouter Model implementation for agentic-go. OpenRouter is an API gateway that routes to many LLM providers (OpenAI, Anthropic, Google, Meta, etc.) through a unified OpenAI-compatible API.
The provider wraps the OpenAI provider with OpenRouter-specific defaults and inherits both streaming and non-streaming capabilities.
Index ¶
Constants ¶
const DefaultBaseURL = "https://openrouter.ai/api/v1"
DefaultBaseURL is the OpenRouter API endpoint.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Model ¶
type Model struct {
*oaiProvider.Model
}
Model wraps the OpenAI provider for OpenRouter. It inherits all methods including Request and RequestStream.
type Option ¶
type Option func(*config)
Option configures the OpenRouter Model.
func WithAPIKey ¶
WithAPIKey sets the API key. If not set, the OPENROUTER_API_KEY env var is used.
func WithAppTitle ¶
WithAppTitle sets the X-Title header shown in OpenRouter dashboards.
func WithBaseURL ¶
WithBaseURL overrides the default OpenRouter base URL.
func WithHTTPReferer ¶
WithHTTPReferer sets the HTTP-Referer header for OpenRouter rankings. This helps OpenRouter attribute traffic to your site.