openrouter

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package openrouter connects to the OpenRouter API.

Index

Constants

View Source
const (
	// ProviderOptionCacheControl is the top-level cache_control object that
	// enables automatic prompt caching, e.g. {"type": "ephemeral", "ttl": "1h"}.
	ProviderOptionCacheControl = "cache_control"
	ProviderOptionSessionID    = "session_id"
	// ProviderOptionRouting is OpenRouter's provider routing object.
	ProviderOptionRouting = "provider"
)

Keys accepted in Request.ProviderOptions, sent as native request fields.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config = compat.Config

Config and Provider are shared with package compat.

type Provider added in v1.9.0

type Provider = compat.Provider

Config and Provider are shared with package compat.

func New

func New(cfg Config) (*Provider, error)

New connects to https://openrouter.ai/api/v1. Thinking maps to the reasoning object (effort or max_tokens, which OpenRouter accepts one at a time, or effort "none" when disabled) and CacheControl to cache_control on content parts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL