anthropic

package
v0.44.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: MIT Imports: 15 Imported by: ? 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

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