adapter

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	Execute(context.Context, Execution) (*Result, error)
	Operate(context.Context, Operation) (OperationResult, error)
}

type CapabilityError

type CapabilityError struct {
	Kind OperationKind
}

func (*CapabilityError) Error

func (e *CapabilityError) Error() string

type Endpoint

type Endpoint string
const (
	EndpointChatCompletions     Endpoint = "chat_completions"
	EndpointResponses           Endpoint = "responses"
	EndpointMessages            Endpoint = "messages"
	EndpointCountTokens         Endpoint = "count_tokens"
	EndpointEmbeddings          Endpoint = "embeddings"
	EndpointImagesGenerations   Endpoint = "images_generations"
	EndpointAudioSpeech         Endpoint = "audio_speech"
	EndpointAudioTranscriptions Endpoint = "audio_transcriptions"
	EndpointModerations         Endpoint = "moderations"
)

type Execution

type Execution struct {
	Endpoint    Endpoint
	Request     *http.Request
	Account     config.Account
	Model       config.Model
	PublicModel string
	Body        []byte
}

type Operation

type Operation struct {
	Kind           OperationKind
	Account        config.Account
	Input          json.RawMessage
	IdempotencyKey string
}

type OperationError

type OperationError struct {
	Code string
}

func (*OperationError) Error

func (e *OperationError) Error() string

type OperationKind

type OperationKind string
const (
	OperationDiscoverModels      OperationKind = "discover_models"
	OperationValidateCredentials OperationKind = "validate_credentials"
	OperationReadUsage           OperationKind = "read_usage"
	OperationListResetCredits    OperationKind = "list_reset_credits"
	OperationConsumeResetCredit  OperationKind = "consume_reset_credit"
)

type OperationResult

type OperationResult struct {
	Data               json.RawMessage
	WarningCode        string
	CredentialRevision int64
}

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Get

func (r *Registry) Get(name string) (Adapter, bool)

func (*Registry) Register

func (r *Registry) Register(name string, ad Adapter) error

type Result

type Result struct {
	Status int
	Header http.Header
	Body   io.ReadCloser
}

Directories

Path Synopsis
Package oauthrefresh holds the generic OAuth token-refresh machinery shared by adapters that mint short-lived access tokens (anthropic): expiry checks, single-flight refresh, control-plane persistence with retry, and snapshot re-adoption on revision conflicts.
Package oauthrefresh holds the generic OAuth token-refresh machinery shared by adapters that mint short-lived access tokens (anthropic): expiry checks, single-flight refresh, control-plane persistence with retry, and snapshot re-adoption on revision conflicts.
Package thirdparty hosts lightweight OpenAI-compatible provider adapters for subscription (OAuth/cookie) and free-tier accounts: Cursor, GitHub Copilot, Kimi, OpenCode Free, Felo, Qoder.
Package thirdparty hosts lightweight OpenAI-compatible provider adapters for subscription (OAuth/cookie) and free-tier accounts: Cursor, GitHub Copilot, Kimi, OpenCode Free, Felo, Qoder.

Jump to

Keyboard shortcuts

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