Automatic inline code completion for VS Code using GPT-5.6 Luna through the local Codex CLI. It uses the ChatGPT/Codex entitlement of your signed-in account (for example, ChatGPT Plus)—no OpenAI API key, SDK, endpoint, or separate API billing.
- Reads the entire file up to 80,000 characters. Larger files use a smart head/cursor/tail window.
- Includes the last six edits and local intent signals such as TODOs, member access, expressions, imports, and declarations.
- Keeps the local Codex app-server persistent, so a new CLI process is not started for every suggestion.
- Disables completion-unrelated tools, plugins, skills, MCP, shell snapshots, and file/network actions.
- Reuses the predicted remainder immediately as you type the beginning of the current suggestion.
- Reduces the default typing debounce from 700 ms to 250 ms.
In a live two-case test on the development machine, both completions were correct: approximately 4.7 seconds for the cold request and 4.0 seconds for the following warm request. Actual latency varies with network conditions, account load, file size, and model service.
-
VS Code 1.125 or newer.
-
Current Codex CLI. Install or update it with:
npm install -g @openai/codex codex --version
-
A ChatGPT account/plan with Codex access.
From a terminal:
code --install-extension ".\codex-luna-inline-0.2.0.vsix" --forceOr in VS Code: open Extensions → … → Install from VSIX…, then select the .vsix file. Reload the VS Code window if prompted.
- Open the Command Palette (
Ctrl+Shift+P). - Run Codex Luna Inline: Choose / Sign in to ChatGPT Account.
- Choose Sign in with ChatGPT.
codex loginopens the official ChatGPT browser login, where you choose the account/workspace.- When ready, the
Codex Lunastatus bar item appears and the completion server warms up.
The Codex CLI does not expose a list of ChatGPT accounts to the extension. The actual account picker is in the secure browser login. To switch accounts, run Codex Luna Inline: Switch ChatGPT Account; it runs codex logout before opening a new browser login.
The account currently open in your browser and the account saved in Codex CLI may be different. Simply switching the browser account does not automatically change the VS Code extension account; use the account-switch command to change the CLI credential.
API-key and access-token authentication are intentionally rejected. OPENAI_API_KEY, CODEX_API_KEY, and CODEX_ACCESS_TOKEN are removed from every child Codex process, so the extension uses only the persisted ChatGPT login.
- Type in a supported text editor. After the default 250 ms pause, the extension requests an inline suggestion.
- Press
Tabto accept the VS Code inline suggestion. - Press
Alt+\to request a suggestion immediately without the debounce. - Click the
Codex Lunastatus bar item for login and account actions. - Run Codex Luna Inline: Toggle Automatic Completions to turn automatic suggestions on or off.
Automatic requests consume your available ChatGPT/Codex usage. Increase the debounce if you want to reduce request frequency.
For files within maxWholeFileChars, the entire source is sent as clearly separated beforeCursor and afterCursor data. The request also includes the cursor location, recent edit previews, language, filename, and lightweight local intent signals. For oversized files, it preserves the file head, a large local cursor window, and the file tail so imports, nearby implementation, and ending structure remain visible.
Source text and comments are explicitly marked as untrusted data, not instructions. The model is asked for structured JSON only; the extension then removes duplicated suffixes, fences, and excessive lines before displaying the result.
- The source context described above is sent to the Codex service through the authenticated local CLI.
- Only trusted workspaces are supported.
.env, credentials, secret-named files, private keys,.npmrc, and.pypircare excluded by default.- Each completion thread is ephemeral, read-only, has no network/tool access, and cannot request approval.
- The process working directory is a separate extension storage folder; completion requests cannot edit project files.
- Prompts, source context, and generated completions are not logged.
- If the local CLI does not support app-server startup, an isolated
codex execfallback is used. You can also disable persistent mode for compatibility troubleshooting.
Review codexLunaInline.excludedFiles if your project has additional sensitive files. Do not enable the extension for code that must not be sent to Codex.
| Setting | Default | Purpose |
|---|---|---|
codexLunaInline.enabled |
true |
Turn automatic completions on or off |
codexLunaInline.codexPath |
codex |
Executable name or absolute path |
codexLunaInline.model |
gpt-5.6-luna |
Codex model slug |
codexLunaInline.reasoningEffort |
low |
Completion speed/depth |
codexLunaInline.debounceMs |
250 |
Delay after typing |
codexLunaInline.timeoutMs |
20000 |
Per-request timeout |
codexLunaInline.maxPrefixChars |
30000 |
Local context before the cursor in oversized files |
codexLunaInline.maxSuffixChars |
15000 |
Local context after the cursor in oversized files |
codexLunaInline.maxWholeFileChars |
80000 |
Whole-file limit before using a smart window |
codexLunaInline.usePersistentServer |
true |
Reuse the warm local Codex process |
codexLunaInline.maxSuggestionLines |
12 |
Maximum output lines |
codexLunaInline.excludedFiles |
Secret-file globs | Files that must not be sent |
Codex CLI / executable not found / access denied
Install the current CLI with npm install -g @openai/codex, restart VS Code, then check where.exe codex. You can also set the full executable path in codexLunaInline.codexPath.
Status says API auth is blocked
Run Codex Luna Inline: Switch ChatGPT Account. This removes the current Codex credential and opens the ChatGPT login.
No inline suggestion
- Run Codex Luna Inline: Check Login Status.
- Make sure VS Code setting
editor.inlineSuggest.enabledis enabled. - Check whether the file matches an excluded-file pattern.
- Open Codex Luna Inline: Show Output Log.
- Luna may validly return no suggestion when the context is ambiguous.
Completion is slow
- Update the Codex CLI and keep
usePersistentServerenabled. - Keep reasoning effort at
low; higher effort may be slower. - Reduce
maxWholeFileCharsfor very large files. - The 250 ms debounce is only the typing wait; network/model latency is separate.
npm install
npm test
npm run packageThe output is codex-luna-inline-0.2.0.vsix in the project root.