@moxxy/plugin-provider-openai-codex is the LLM provider for the ChatGPT-plan Codex backend. Auth is the user's ChatGPT Pro/Plus account via OAuth (PKCE loopback or device-code); the rest of the request body is the OpenAI Responses API shape.
Install
sh
pnpm add @moxxy/plugin-provider-openai-codexSign in
sh
moxxy login openai-codex
# Opens your browser, listens on http://localhost:8765/callback,
# exchanges the code, stores tokens in the vault.--no-browser (or a non-TTY stdin) forces device-code flow.
Use
ts
import { openaiCodexPlugin } from '@moxxy/plugin-provider-openai-codex';
session.pluginHost.registerStatic(openaiCodexPlugin);
session.providers.setActive('openai-codex');In moxxy.config.ts:
ts
provider: {
name: 'openai-codex',
model: 'codex-1', // see DEFAULT_CODEX_MODEL
}Token rotation
Refresh tokens rotate on every refresh (single-use). The provider's onTokensRefreshed callback writes the new bundle back to the vault before the next API call goes out — the CLI's setup wires this for you.
Exports
openaiCodexPlugin,openaiCodexProviderDefCodexProvider,CodexProviderConfigcodexModels,DEFAULT_CODEX_MODELcodexOauthProfile,CODEX_PROVIDER_ID—OAuthProviderProfileconsumed by@moxxy/plugin-oauth'srunOauthLogin/ensureFreshTokens- OAuth helpers (
CLIENT_ID,ISSUER,AUTHORIZE_URL,TOKEN_URL,CODEX_RESPONSES_URL,DEFAULT_CALLBACK_PORT,DEFAULT_REDIRECT_PATH,DEFAULT_REDIRECT_URI,SCOPES,ORIGINATOR,generatePKCE,generateState,buildAuthorizeUrl,parseJwtClaims,extractAccountId,exchangeCodeForTokens,refreshTokens) toResponsesBody,toResponsesInput,toResponsesTools— translatorscodexLogin,codexLogout,codexStatus— theauthhooksreadStoredTokens,persistCodexTokens,ensureFreshCodexTokens— vault helpers in theCodexTokensshape (delegate to@moxxy/plugin-oauth's generic storage underoauth/openai-codex/*)
See also
- Provider OAuth login guide.
- @moxxy/plugin-oauth — the generic OAuth client.
