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 ¶
NewOpenAIChat returns the OpenAI Chat Completions 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.