openrouter

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Architecture

type Architecture struct {
	Modality         string   `json:"modality"`
	InputModalities  []string `json:"input_modalities"`
	OutputModalities []string `json:"output_modalities"`
	Tokenizer        string   `json:"tokenizer"`
	InstructType     *string  `json:"instruct_type"`
}

type Endpoint

type Endpoint struct {
	Name                string   `json:"name"`
	ContextLength       int64    `json:"context_length"`
	Pricing             Pricing  `json:"pricing"`
	ProviderName        string   `json:"provider_name"`
	Tag                 string   `json:"tag"`
	Quantization        *string  `json:"quantization"`
	MaxCompletionTokens *int64   `json:"max_completion_tokens"`
	MaxPromptTokens     *int64   `json:"max_prompt_tokens"`
	SupportedParams     []string `json:"supported_parameters"`
	Status              int      `json:"status"`
	UptimeLast30m       float64  `json:"uptime_last_30m"`
}

type Model

type Model struct {
	ID              string       `json:"id"`
	CanonicalSlug   string       `json:"canonical_slug"`
	HuggingFaceID   string       `json:"hugging_face_id"`
	Name            string       `json:"name"`
	Created         int64        `json:"created"`
	Description     string       `json:"description"`
	ContextLength   int64        `json:"context_length"`
	Architecture    Architecture `json:"architecture"`
	Pricing         Pricing      `json:"pricing"`
	TopProvider     TopProvider  `json:"top_provider"`
	SupportedParams []string     `json:"supported_parameters"`
}

type Models

type Models []Model

func FetchModels

func FetchModels(ctx context.Context) (Models, error)

func (Models) Lookup

func (m Models) Lookup(idOrName string) *Model

type ModelsResponse

type ModelsResponse struct {
	Data Models `json:"data"`
}

type PricePerToken

type PricePerToken float64

func (PricePerToken) Cost

func (p PricePerToken) Cost(tokens int) float64

func (PricePerToken) CostPer1MIn

func (p PricePerToken) CostPer1MIn() float64

func (PricePerToken) MarshalJSON

func (p PricePerToken) MarshalJSON() ([]byte, error)

func (*PricePerToken) UnmarshalJSON

func (p *PricePerToken) UnmarshalJSON(data []byte) error

type Pricing

type Pricing struct {
	Prompt            PricePerToken `json:"prompt"`
	Completion        PricePerToken `json:"completion"`
	Request           PricePerToken `json:"request"`
	Image             PricePerToken `json:"image"`
	WebSearch         PricePerToken `json:"web_search"`
	InternalReasoning PricePerToken `json:"internal_reasoning"`
	InputCacheRead    PricePerToken `json:"input_cache_read"`
	InputCacheWrite   PricePerToken `json:"input_cache_write"`
}

type TopProvider

type TopProvider struct {
	ContextLength       int64  `json:"context_length"`
	MaxCompletionTokens *int64 `json:"max_completion_tokens"`
	IsModerated         bool   `json:"is_moderated"`
}

Jump to

Keyboard shortcuts

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