codex

package
v1.4.473 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package codex provides a subscription-backed OpenAI OAuth vendor that talks to the private Codex backend for supported models.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*openaivendor.Client

	AccessToken  *plugins.Setting
	RefreshToken *plugins.Setting
	AccountID    *plugins.Setting
	AuthBaseURL  *plugins.SetupQuestion

	// TokenPersist writes current tokens after refresh. Nil skips. Error fails the refresh.
	TokenPersist func() error
	// WithStoreLock, when set, wraps refresh+persist (reload tokens inside the lock).
	WithStoreLock func(func() error) error
	// contains filtered or unexported fields
}

Client implements the Codex-backed AI vendor.

func NewClient

func NewClient() *Client

NewClient creates a new Codex vendor client.

func (*Client) ListModels

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

ListModels returns the Codex models available to the configured account.

func (*Client) LoadEnvSettings added in v1.4.471

func (c *Client) LoadEnvSettings(env map[string]string)

LoadEnvSettings copies non-empty Codex token values from env.

func (*Client) Send

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

Send sends a request to Codex and returns the final text output.

func (*Client) SendStream

func (c *Client) SendStream(
	ctx context.Context, msgs []*chat.ChatCompletionMessage, opts *domain.ChatOptions, channel chan domain.StreamUpdate,
) error

SendStream sends a request to Codex and streams the response text updates.

func (*Client) Setup

func (c *Client) Setup() error

Setup runs interactive Codex configuration, including browser-based OAuth.

Jump to

Keyboard shortcuts

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