proxy

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package proxy implements a stream.Model that proxies LLM calls through an Airlock-compatible NDJSON endpoint (POST /api/agent/llm/stream).

This allows Sol and agentsdk to call LLMs without holding API keys — credentials are managed server-side by the proxy.

Proxy implementations for non-language models (image, embedding, speech, transcription). These use simple JSON request/response (not NDJSON streaming).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmbeddingModel

func EmbeddingModel(opts Options) model.EmbeddingModel

EmbeddingModel returns a model.EmbeddingModel that proxies calls through Airlock.

func ImageModel

func ImageModel(opts Options) model.ImageModel

ImageModel returns a model.ImageModel that proxies calls through Airlock.

func Model

func Model(modelID string, opts Options) stream.Model

Model returns a stream.Model that proxies calls through the configured endpoint. The modelID is the full provider/model string (e.g., "anthropic/claude-sonnet-4-20250514").

func SpeechModel

func SpeechModel(opts Options) model.SpeechModel

SpeechModel returns a model.SpeechModel that proxies calls through Airlock.

func TranscriptionModel

func TranscriptionModel(opts Options) model.TranscriptionModel

TranscriptionModel returns a model.TranscriptionModel that proxies calls through Airlock.

Types

type Options

type Options struct {
	// BaseURL is the proxy server base URL (e.g., "http://localhost:8080").
	BaseURL string

	// Token is the Bearer token for authentication.
	Token string

	// Path is the proxy endpoint path. Defaults to "/api/agent/llm/stream".
	Path string

	// Slug is a run-level label for logging/tracking (e.g., "ocr", "summarize").
	Slug string

	// Capability is the model capability (e.g., "text", "vision").
	Capability string

	// Client is the HTTP client to use. Defaults to http.DefaultClient.
	Client *http.Client

	// MaxRetries is the maximum number of retry attempts for transient errors.
	// Defaults to 5.
	MaxRetries int
}

Options configures the proxy provider.

Jump to

Keyboard shortcuts

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