proxy

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 15 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

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