anthropic

package
v0.34.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anthropic

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

Anthropic implements core.Provider for the Anthropic Messages API. Supports both API key auth and OAuth tokens (Claude Max).

func New

func New(apiKey string) *Anthropic

New creates an Anthropic provider. Automatically detects OAuth tokens by their "sk-ant-oat" prefix.

func NewWithBaseURL

func NewWithBaseURL(apiKey, baseURL string) *Anthropic

NewWithBaseURL creates an Anthropic provider with a custom base URL (for testing).

func (*Anthropic) IsOAuth

func (a *Anthropic) IsOAuth() bool

IsOAuth returns true if this provider is using an OAuth token.

func (*Anthropic) Stream

func (a *Anthropic) Stream(ctx context.Context, req core.Request) (<-chan core.AssistantEvent, error)

Stream sends a request to the Anthropic Messages API and returns a channel of normalized AssistantEvents.

Error contract:

  • Returns error for pre-stream failures (bad request, auth, network).
  • If channel is returned, exactly one terminal event ("done" or "error") will be sent before the channel is closed.

func (*Anthropic) SupportsDocuments

func (a *Anthropic) SupportsDocuments() bool

SupportsDocuments returns true: Anthropic document blocks are GA for both API-key and OAuth auth.

Jump to

Keyboard shortcuts

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