codex

package
v0.20260526.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 21 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

Index

Constants

View Source
const (
	ChatGPTSubAPIBase   = "https://chatgpt.com/backend-api/codex"
	ChatGPTResponsesURL = "https://chatgpt.com/backend-api/codex/responses"
	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"
	UserAgent           = "codex_cli_rs/0.38.0 (Ubuntu 22.04.0; x86_64) WindowsTerminal"
	CallbackAddr        = "127.0.0.1:1455"
	CallbackPath        = "/auth/callback"
)

Variables

This section is empty.

Functions

func BuildAuthorizeURL

func BuildAuthorizeURL(pkce PKCE) string

func BuildCodexInput added in v0.20260525.0

func BuildCodexInput(chat map[string]any) []any

func ChatCompletionToCodexBody added in v0.20260525.0

func ChatCompletionToCodexBody(chat map[string]any) ([]byte, error)

func ChatGPTAccountIDFromJWT

func ChatGPTAccountIDFromJWT(token string) string

func SubModelCatalog

func SubModelCatalog() []string

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)

Jump to

Keyboard shortcuts

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