codex

package
v0.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package codex implements the OpenAI Plus (ChatGPT Codex) provider.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client wraps the OpenAI-compatible client with Codex-specific authentication and endpoints. Uses a private field (not embedding) to prevent OpenAI's Embed/Transcribe/Synthesize methods from being promoted — Codex does not support those capabilities.

func New

func New(token, authFilePath string, timeout time.Duration) *Client

New creates a Codex client using the given refresh token, optional auth file path for token rotation, and timeout.

func (*Client) Chat

Chat injects store: false and instructions before delegating to Fantasy. Codex backend requires the instructions field explicitly (unlike standard OpenAI which accepts system messages in the input array).

func (*Client) Estimate

func (c *Client) Estimate(ctx context.Context, req request.Request, text string) (int, error)

Estimate delegates to the inner OpenAI client's token estimation.

func (*Client) Model

func (c *Client) Model(ctx context.Context, name string) (model.Model, error)

Model returns metadata for the specified Codex model by name. Uses a lazy-loaded cache to avoid re-fetching the full model list on every call.

func (*Client) Models

func (c *Client) Models(ctx context.Context) (model.Models, error)

Models fetches available Codex models from the ChatGPT backend.

Jump to

Keyboard shortcuts

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