codex

package
v2026.909.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthorizeURL = "https://auth.openai.com/oauth/authorize"
	TokenURL     = "https://auth.openai.com/oauth/token"
	ClientID     = "app_EMoamEEZ73f0CkXaXp7hrann"
	RedirectURI  = "http://localhost:1455/auth/callback"
	Scopes       = "openid profile email offline_access api.connectors.read api.connectors.invoke"
	Originator   = "codex_cli_rs"
	// ClientVersion is the offline fallback; requests resolve npm latest dynamically.
	ClientVersion = "0.153.3"
	CallbackAddr  = "127.0.0.1:1455"
	CallbackPath  = "/auth/callback"
)

Variables

View Source
var (
	ChatGPTSubAPIBase   = "https://chatgpt.com/backend-api/codex"
	ChatGPTResponsesURL = "https://chatgpt.com/backend-api/codex/responses"
)
View Source
var CodexVersionRegistryURL = "https://registry.npmjs.org/@openai%2Fcodex/latest"

CodexVersionRegistryURL returns metadata for npm's stable latest tag.

Functions

func BuildAuthorizeURL

func BuildAuthorizeURL(pkce PKCE) string

func ChatGPTAccountIDFromJWT

func ChatGPTAccountIDFromJWT(token string) string

func ListModels added in v2026.716.0

func ListModels(ctx context.Context, bearer, accountID string) ([]string, error)

func ResolveClientVersion added in v2026.909.0

func ResolveClientVersion(ctx context.Context, force bool) string

ResolveClientVersion checks npm at most once per six hours, unless forced. Registry failures preserve the cached version, or the built-in fallback on first use, and are retried after five minutes. No OAuth credentials go to npm.

func WithChatGPTSubMiddleware

func WithChatGPTSubMiddleware(accountID string) option.RequestOption

Types

type PKCE

type PKCE struct {
	Verifier  string
	Challenge string
	State     string
}

func NewPKCE

func NewPKCE() (PKCE, error)

type TokenSet

type TokenSet struct {
	AccessToken  string
	RefreshToken string
	AccountID    string
	ExpiresAt    time.Time
}

func Login

func Login(ctx context.Context, out io.Writer) (ts TokenSet, err error)

func Refresh

func Refresh(ctx context.Context, refreshToken string) (TokenSet, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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