anthropic

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package anthropic implements the Adapter as a transparent passthrough to a native Anthropic Messages API (api.anthropic.com or a compatible endpoint). It performs NO dialect translation: requests are forwarded verbatim and responses returned unchanged (see translate.Identity). Its value is shim's observability — redacted logs, /v1/metrics, loud-fail — in front of a real Anthropic endpoint with zero translation risk.

Construct via New and register from cmd/shim/main.go, mirroring the deepseek adapter; no init()-time registration.

Index

Constants

View Source
const (
	// Name is the registry key (config ADAPTER=anthropic).
	Name = "anthropic"
	// DefaultBaseURL is used when UPSTREAM_BASE_URL is empty.
	DefaultBaseURL = "https://api.anthropic.com"
	// DefaultAnthropicVersion is sent when the client omits anthropic-version.
	// Anthropic requires the header; shim supplies a default and logs the
	// inject (thesis-2: never silently modify inbound traffic).
	DefaultAnthropicVersion = "2023-06-01"
)

Variables

This section is empty.

Functions

func New

func New(opts ConfigureOpts) (adapter.Adapter, error)

New constructs a configured passthrough adapter. Caller registers the returned adapter via adapter.Register. The config gate is Validate at server startup.

Types

type ConfigureOpts

type ConfigureOpts struct {
	BaseURL string
	APIKey  string
	Logger  *slog.Logger // for the version-inject loud-fail line
}

ConfigureOpts holds New parameters as a struct so signature changes don't ripple to call sites.

Jump to

Keyboard shortcuts

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