openai

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APIKeyMeta = provider.ProviderMeta{
	Provider:    provider.ProviderOpenAI,
	AuthMethod:  provider.AuthAPIKey,
	EnvVars:     []string{"OPENAI_API_KEY"},
	DisplayName: "Direct API",
}

APIKeyMeta is the metadata for OpenAI via API Key

Functions

func NewAPIKeyClient

func NewAPIKeyClient(ctx context.Context) (provider.LLMProvider, error)

NewAPIKeyClient creates a new OpenAI client using API Key authentication

Types

type Client

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

Client implements the LLMProvider interface using the OpenAI SDK

func NewClient

func NewClient(client openai.Client, name string) *Client

NewClient creates a new OpenAI client with the given SDK client

func (*Client) ListModels

func (c *Client) ListModels(ctx context.Context) ([]provider.ModelInfo, error)

ListModels returns the available models for OpenAI using the API

func (*Client) Name

func (c *Client) Name() string

Name returns the provider name

func (*Client) Stream

func (c *Client) Stream(ctx context.Context, opts provider.CompletionOptions) <-chan provider.StreamChunk

Stream sends a completion request and returns a channel of streaming chunks

Jump to

Keyboard shortcuts

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