openai

package
v1.1.66 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultModels

func DefaultModels() []*provider.Model

DefaultModels returns the default OpenAI model list.

Types

type Provider

type Provider struct {
	provider.BaseProvider
	// contains filtered or unexported fields
}

Provider implements the OpenAI Chat Completions API.

func NewProvider

func NewProvider(apiKey, baseURL string) *Provider

NewProvider creates a new OpenAI provider with default models.

func NewProviderWithModels

func NewProviderWithModels(apiKey, baseURL string, models []*provider.Model) *Provider

NewProviderWithModels creates a new OpenAI provider with custom models.

func NewProviderWithModelsAndOptions

func NewProviderWithModelsAndOptions(apiKey, baseURL string, models []*provider.Model, opts provider.HTTPClientOptions) (*Provider, error)

func NewProviderWithModelsAndProxy

func NewProviderWithModelsAndProxy(apiKey, baseURL, proxyURL string, models []*provider.Model) (*Provider, error)

func (*Provider) API

func (p *Provider) API() string

API returns the protocol/API type.

func (*Provider) Chat

func (p *Provider) Chat(ctx context.Context, params provider.ChatParams) <-chan provider.StreamEvent

Chat implements the streaming chat interface.

func (*Provider) DisableReasoning

func (p *Provider) DisableReasoning()

DisableReasoning disables reasoning_content support for incompatible APIs.

func (*Provider) IsReasoningDisabled

func (p *Provider) IsReasoningDisabled() bool

IsReasoningDisabled returns whether reasoning support is disabled.

func (*Provider) SetHeaders

func (p *Provider) SetHeaders(headers map[string]string)

SetHeaders sets custom HTTP headers applied to every provider request.

func (*Provider) SetResponsesConfig

func (p *Provider) SetResponsesConfig(cfg config.ResponsesConfig)

SetResponsesConfig applies Responses API-specific configuration.

func (*Provider) SetRetryConfig

func (p *Provider) SetRetryConfig(cfg *provider.RetryConfig)

SetRetryConfig sets the retry configuration for this provider.

func (*Provider) SetThinkingFormat

func (p *Provider) SetThinkingFormat(format string)

SetThinkingFormat sets the thinking parameter format. "openai" = reasoning_effort, "deepseek" = thinking + reasoning_effort, "xiaomi" = legacy thinking-only format.

func (*Provider) SetUseResponsesAPI

func (p *Provider) SetUseResponsesAPI(enabled bool)

SetUseResponsesAPI switches the provider to the Responses API.

Jump to

Keyboard shortcuts

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