provider

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(model core.Model, cfg Config) (core.Provider, error)

New creates a Provider for the given model.

The model's Provider field determines which implementation to use:

  • "anthropic": Anthropic API (Claude models)
  • "openai": OpenAI API (GPT/o-series models). Uses OAuth constructor when IsOAuth=true.

Returns error for unsupported or empty provider names.

Types

type AuthKind added in v0.26.0

type AuthKind string
const (
	AuthKindAPIKey AuthKind = "api_key"
	AuthKindOAuth  AuthKind = "oauth"
)

type Config

type Config struct {
	APIKey    string // API key or OAuth access token
	IsOAuth   bool   // Whether APIKey is an OAuth token
	AccountID string // OpenAI OAuth account ID (required when IsOAuth=true for OpenAI)
	AuthKind  AuthKind
	// RefreshOAuth is called only by consumer transports after a rejected OAuth
	// access token. API-key transports never invoke it.
	RefreshOAuth func(rejectedToken string) (string, error)
}

Config holds credentials needed to create a provider.

Directories

Path Synopsis
Package openai implements core.Provider for the OpenAI Responses API.
Package openai implements core.Provider for the OpenAI Responses API.
Package responses implements the provider-neutral Responses API wire codec.
Package responses implements the provider-neutral Responses API wire codec.
Package retry provides HTTP retry logic with exponential backoff for LLM provider API calls.
Package retry provides HTTP retry logic with exponential backoff for LLM provider API calls.
Package sseutil provides shared utilities for SSE stream handling across LLM provider implementations.
Package sseutil provides shared utilities for SSE stream handling across LLM provider implementations.
Package xai implements the public xAI Responses API transport.
Package xai implements the public xAI Responses API transport.

Jump to

Keyboard shortcuts

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