{"modulePath":"github.com/memcode-ai/memcode","version":"v0.56.16","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package codex\n\nPackage codex turns a ChatGPT (Codex) subscription into a memcode backend by reusing the login the Codex CLI already stored. It reads ~/.codex/auth.json (or $CODEX\\_HOME), refreshes the access token when it's expiring, pulls the account id out of the access-token JWT, and returns the ChatGPT/Codex endpoint plus the identity headers Cloudflare and the backend require. No vendor SDK — file read + OAuth refresh + JWT decode — so it returns a plain Backend the provider package adapts to an endpoint.\n\nConsent-gated upstream: it activates only when the user explicitly selects the codex source. It reuses the Codex CLI's file and, on a refresh, writes the rotated tokens back there so both tools stay in sync on the single-use refresh token.\n\n## Functions\n\n```go\nfunc Available() bool\n```\nAvailable reports whether a Codex CLI login file is present, for the wizard's menu (no parse, no network).\n\n## Types\n\n```go\ntype Backend struct {\n\tBaseURL string\n\tToken   string\n\tHeaders map[string]string\n}\n```\nBackend is the resolved Codex endpoint: the ChatGPT backend base, the access token (Bearer), and the identity headers every turn must carry.\n\n```go\nfunc Resolve() (Backend, error)\n```\nResolve reads the Codex CLI login, refreshes it if the access token is expiring, and shapes it into a backend. An error explains the fix (install/sign in with the Codex CLI).\n\n","path":"github.com/memcode-ai/memcode/internal/subscription/codex","name":"codex","synopsis":"Package codex turns a ChatGPT (Codex) subscription into a memcode backend by reusing the login the Codex CLI already stored.","isRedistributable":true}
