codex

package
v1.7.19 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 39 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package codex connects Codex clients to CCL providers without moving native Codex or Claude credentials. The desktop picker and routing allow-list are deliberately separate: only names owned by CCL can reach a CCL runtime.

Index

Constants

View Source
const IndependentProviderID = "ccl_proxy"

Variables

This section is empty.

Functions

func FindExecutable

func FindExecutable() (string, error)

func Home

func Home() (string, error)

Types

type Catalog

type Catalog struct {
	Models []Model `json:"models"`
}

func MergeCatalog

func MergeCatalog(native Catalog, custom []Model) (Catalog, error)

func ParseCatalog

func ParseCatalog(data []byte) (Catalog, error)

type ConfigChange

type ConfigChange struct {
	Scope   []string `json:"scope,omitempty"`
	Key     string   `json:"key"`
	Before  *string  `json:"before"`
	Applied *string  `json:"applied"`
}

type Gateway

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

func New

func New(ctx context.Context, runtime *oauthproxy.Runtime, configured provider.Provider, options Options) (*Gateway, error)

New wraps the standalone proxy's existing runtime. Close never stops that runtime: proxymanager owns its credential refresh and lifetime.

func (*Gateway) BaseURL

func (g *Gateway) BaseURL() string

func (*Gateway) Close

func (g *Gateway) Close()

func (*Gateway) Models

func (g *Gateway) Models() []Model

func (*Gateway) RefreshMetadata added in v1.7.19

func (g *Gateway) RefreshMetadata(configured provider.Provider, persist func([]Model) error) error

RefreshMetadata changes client catalog settings only. Routes, authentication, the runtime and conversation history remain owned by the existing session. Persist the new catalog before publishing it to concurrent HTTP readers.

func (*Gateway) Token

func (g *Gateway) Token() string

type Model

type Model map[string]any

Model preserves Codex's catalog fields, including fields introduced by newer clients. Native entries are never reconstructed from a /v1/models list.

type Options

type Options struct {
	// Independent selects a custom provider with its own loopback credential,
	// rather than sharing OpenAI's provider/account state in the desktop app.
	Independent bool
	Desktop     bool
	// ListenAddress preserves the desktop endpoint across daemon replacement.
	// It may only name an explicit IPv4 loopback port; empty chooses a free one.
	ListenAddress string
	// Native upstream overrides are for local integration fixtures. Commands
	// never populate them from client requests or environment variables.
	OpenAIURL  string
	ChatGPTURL string
}

type Overlay

type Overlay struct {
	Path          string         `json:"path"`
	CatalogPath   string         `json:"catalog_path"`
	BaseURL       string         `json:"base_url"`
	Changes       []ConfigChange `json:"changes"`
	ProviderBlock string         `json:"provider_block,omitempty"`
}

func Plan

func Plan(ctx context.Context, g *Gateway, directory string) (*Overlay, error)

Plan writes only the proxy-owned catalog, never the user's configuration. The lifecycle manager journals Changes before Apply touches config.toml.

func (*Overlay) Apply

func (o *Overlay) Apply(ctx context.Context) error

func (*Overlay) RefreshCatalog added in v1.7.19

func (o *Overlay) RefreshCatalog(models []Model) error

RefreshCatalog updates only CCL-owned metadata in the existing file. It never rewrites config.toml, rotates independent credentials, or reconstructs native entries. The catalog path and overlay's restoration journal stay unchanged.

func (*Overlay) Restore

func (o *Overlay) Restore(ctx context.Context) error

type Route

type Route struct {
	Alias           string
	Model           string
	NativeResponses bool
	ThinkingBudget  bool
	MaxOutputTokens int
}

Jump to

Keyboard shortcuts

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