anthropic

package
v1.4.310 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RefreshToken

func RefreshToken(tokenIdentifier string) (string, error)

RefreshToken refreshes an expired OAuth token using the refresh token

func RunOAuthFlow

func RunOAuthFlow(tokenIdentifier string) (token string, err error)

RunOAuthFlow executes the complete OAuth authorization flow

Types

type Client

type Client struct {
	*plugins.PluginBase
	ApiBaseURL *plugins.SetupQuestion
	ApiKey     *plugins.SetupQuestion
	UseOAuth   *plugins.SetupQuestion
	// contains filtered or unexported fields
}

func NewClient

func NewClient() (ret *Client)

func (*Client) IsConfigured

func (an *Client) IsConfigured() bool

IsConfigured returns true if either the API key or OAuth is configured

func (*Client) ListModels

func (an *Client) ListModels() (ret []string, err error)

func (*Client) NeedsRawMode

func (an *Client) NeedsRawMode(modelName string) bool

func (*Client) Send

func (an *Client) Send(ctx context.Context, msgs []*chat.ChatCompletionMessage, opts *domain.ChatOptions) (
	ret string, err error)

func (*Client) SendStream

func (an *Client) SendStream(
	msgs []*chat.ChatCompletionMessage, opts *domain.ChatOptions, channel chan string,
) (err error)

func (*Client) Setup

func (an *Client) Setup() (err error)

type OAuthTransport

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

OAuthTransport is a custom HTTP transport that adds OAuth Bearer token and beta header

func NewOAuthTransport

func NewOAuthTransport(client *Client, base http.RoundTripper) *OAuthTransport

NewOAuthTransport creates a new OAuth transport for the given client

func (*OAuthTransport) RoundTrip

func (t *OAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the http.RoundTripper interface

Jump to

Keyboard shortcuts

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