proxy

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatEvents

func FormatEvents(events []string) string

FormatEvents formats a list of raw event strings back into SSE response payloads.

Types

type ResponsesStreamTransformer added in v1.2.4

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

func (*ResponsesStreamTransformer) TranslateBlock added in v1.2.4

func (st *ResponsesStreamTransformer) TranslateBlock(block string) ([]string, error)

type Server

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

func NewServer

func NewServer(addr string, p provider.Provider, logger *slog.Logger) *Server

func (*Server) Addr

func (s *Server) Addr() string

Addr returns the bound listener address (useful if port is randomly allocated).

func (*Server) AvailableModels

func (s *Server) AvailableModels() string

func (*Server) Start

func (s *Server) Start() error

Start runs the local proxy server on the configured address. It is non-blocking and starts the server in a background goroutine.

func (*Server) Stop

func (s *Server) Stop()

Stop shuts down the proxy server cleanly.

type StreamTransformer

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

StreamTransformer coordinates translating a stream of OpenAI chunks into Anthropic SSE chunks.

func (*StreamTransformer) Finish added in v1.2.4

func (st *StreamTransformer) Finish() []string

func (*StreamTransformer) TranslateChunk

func (st *StreamTransformer) TranslateChunk(line string) ([]string, error)

TranslateChunk transforms a single raw line of "data: {...}" from OpenAI into one or more Anthropic SSE events.

Jump to

Keyboard shortcuts

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