Documentation
¶
Overview ¶
Package openrouter provides the OpenRouter-specific construction and request options for the OpenAI-compatible Chat Completions API.
Index ¶
- func New(selected model.Model, key auth.APIKey, options ...Option) (inference.Client, error)
- type Option
- func WithHTTPReferer(value string) Option
- func WithPromptCacheKey(value string) Option
- func WithProviderRouting(options ProviderRoutingOptions) Option
- func WithReasoning(options ReasoningOptions) Option
- func WithTLSRootCAs(roots *x509.CertPool) Option
- func WithTitle(value string) Option
- func WithUsage(include bool) Option
- type ProviderRoutingOptions
- type ReasoningOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*config)
Option customizes an OpenRouter client at construction time.
func WithHTTPReferer ¶
WithHTTPReferer adds OpenRouter's optional HTTP-Referer attribution header.
func WithPromptCacheKey ¶
WithPromptCacheKey sets OpenRouter's stable prompt-cache key.
func WithProviderRouting ¶
func WithProviderRouting(options ProviderRoutingOptions) Option
WithProviderRouting adds OpenRouter provider-routing preferences.
func WithReasoning ¶
func WithReasoning(options ReasoningOptions) Option
WithReasoning adds OpenRouter's reasoning request object.
func WithTLSRootCAs ¶
WithTLSRootCAs installs a caller-owned verified certificate pool for tests and controlled clients; nil is rejected rather than silently using defaults.
type ProviderRoutingOptions ¶
type ProviderRoutingOptions struct {
Order []string `json:"order,omitempty"`
AllowFallbacks *bool `json:"allow_fallbacks,omitempty"`
RequireParameters *bool `json:"require_parameters,omitempty"`
DataCollection string `json:"data_collection,omitempty"`
ZDR *bool `json:"zdr,omitempty"`
}
ProviderRoutingOptions controls OpenRouter's provider-selection policy. Pointer fields preserve the difference between an omitted value and an explicitly supplied false.
type ReasoningOptions ¶
type ReasoningOptions struct {
Effort string `json:"effort,omitempty"`
MaxTokens *int `json:"max_tokens,omitempty"`
Exclude *bool `json:"exclude,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Context string `json:"context,omitempty"`
Mode string `json:"mode,omitempty"`
}
ReasoningOptions controls OpenRouter's provider-specific reasoning object. Pointer fields preserve the difference between an omitted value and an explicitly supplied false or zero.