upstream

package
v1.261203.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MPL-2.0 Imports: 19 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

Overview

Package upstream provides the terminal Protocol Stage endpoints: one per chain protocol, each forwarding a native request to the selected provider through the existing internal/forwarding functions.

Endpoints only forward. Request preparation (vendor transforms, field cleanup, consistency) runs in stages before the terminal, exactly as the transform chain runs before forwarding today, and response shaping for the client (model rewrite, usage stripping) belongs to the client edge.

Anthropic is Beta inside the chain. A provider reached over the V1 wire is served by the same Beta endpoint with AnthropicWireV1: the request is downgraded just before forwarding and the response upgraded right after, so the provider sees exactly what the V1 path sends today.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAnthropic

func NewAnthropic(config Config, wire AnthropicWire) (stage.Endpoint, error)

NewAnthropic returns the Anthropic Beta terminal endpoint.

func NewOpenAIChat

func NewOpenAIChat(config Config) (stage.Endpoint, error)

NewOpenAIChat returns the OpenAI Chat Completions terminal endpoint.

func NewOpenAIResponses

func NewOpenAIResponses(config Config) (stage.Endpoint, error)

NewOpenAIResponses returns the OpenAI Responses terminal endpoint.

Types

type AnthropicWire

type AnthropicWire uint8

AnthropicWire is the wire an Anthropic provider is reached over.

const (
	// AnthropicWireBeta sends the Beta request as is (?beta=true).
	AnthropicWireBeta AnthropicWire = iota
	// AnthropicWireV1 downgrades the request to V1 and upgrades the response,
	// for routes that reach the provider over the V1 wire.
	AnthropicWireV1
)

type Clients

type Clients interface {
	GetAnthropicClient(ctx context.Context, provider *typ.Provider, model string) client.AnthropicClientInterface
	GetOpenAIClient(ctx context.Context, provider *typ.Provider, model string) client.OpenAIClientInterface
}

Clients resolves provider clients; *client.ClientPool implements it.

type Config

type Config struct {
	Clients  Clients
	Provider *typ.Provider
	// Model is the provider-bound model used to resolve the client.
	Model string
	// StreamOnly marks a provider that only streams (Codex): a complete call
	// is sent as a stream and answered with the stream's final response.
	StreamOnly bool
}

Config selects the provider and provider-bound model for one attempt.

Jump to

Keyboard shortcuts

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