The shape of the setup is:
- Run
apfel --serveas a local OpenAI-compatible server. - Use the Continue extension in Visual Studio Code.
- Route chat/code review to local
apfel. - Route edit/apply to a second model.
- Keep
~/.continue/.envin sync from the shell so Continue can readOPENAI_API_KEY.
For the underlying API contract, see openai-api-compatibility.md and server-security.md.
Use apfel as the local OpenAI-compatible base URL:
http://127.0.0.1:11434/v1
Start it in the foreground:
apfel --serveOr run it in the background:
brew services start apfelBackground-service details: background-service.md
Important: this setup uses Chat Completions (POST /v1/chat/completions), which is what Continue's openai provider speaks. apfel also implements the newer Responses API (POST /v1/responses), but Continue does not use it here.
Use Continue as the Visual Studio Code front end.
Continue reads configuration from:
~/.continue/config.yaml~/.continue/.env
Use local apfel for safer chat/review work and a second model for edit/apply.
Create or replace ~/.continue/config.yaml with:
name: Apfel Review + OpenAI Apply
version: 0.0.1
schema: v1
models:
- name: apfel-review
provider: openai
model: apple-foundationmodel
apiBase: http://127.0.0.1:11434/v1
apiKey: ignored
roles:
- chat
contextLength: 4096
defaultCompletionOptions:
temperature: 0.0
maxTokens: 256
requestOptions:
extraBodyProperties:
x_context_output_reserve: 256
chatOptions:
baseSystemMessage: |
You are a code review assistant.
Prioritize bugs, regressions, edge cases, security risks, and missing tests.
Give findings first and be concrete.
- name: gpt-5.1-apply
provider: openai
model: gpt-5.1
apiKey: ${{ secrets.OPENAI_API_KEY }}
roles:
- edit
- apply
defaultCompletionOptions:
temperature: 0.0
maxTokens: 1200
context:
- provider: diff
- provider: fileWhy this split works:
apfel-reviewis restricted tochat, so it becomes the local review lane.gpt-5.1-applyhandleseditandapply, where a stronger hosted model is more useful.temperature: 0.0keeps both lanes deterministic.contextLength: 4096is the window on macOS 26 and on M1/M2 Macs. On macOS 27 with an M3 or newer chip and 12 GB+ the on-device window is 8192, so setcontextLength: 8192there -apfel --model-infoprints the live value for your machine. The window covers input and output combined.
Continue reads secrets from ~/.continue/.env.
The direct manual version is:
OPENAI_API_KEY=your_openai_api_key_hereBut in our setup, we also wired this into the shell so Continue's .env file is updated automatically from the existing Codex login helpers in ~/.zshrc. (See: Leveraging multiple, repository-specific OpenAI Codex API Keys with Visual Studio Code on macOS.)
Inside the # --- OpenAI Codex: Start / # --- OpenAI Codex: End block in ~/.zshrc, we added helpers so that:
clilogs Codex in and writesOPENAI_API_KEY=...to~/.continue/.envclologs Codex out and removes only theOPENAI_API_KEYline from~/.continue/.env
This keeps the Continue secret in step with your Codex/OpenAI shell workflow without manual edits. Your typical flow becomes:
source ~/.zshrc
cliWhen you are done with the Visual Studio Code session:
cloAfter changing auth state, reload Visual Studio Code's extension host so Continue picks up the current environment and config.
Use:
Cmd + Shift + P -> Developer: Restart Extension Host
Use local apfel for:
- review the current diff
- review the selected function
- summarize a file before editing
- identify likely regressions
- point out missing tests
Use the hosted edit/apply model for:
- targeted code changes
- apply/fix flows
- rewriting a selected block
- generating a patch after review findings are clear
This is the important habit: keep apfel focused on small review contexts. It works best on a diff, one file, or one selected region, not giant repo-wide prompts.
- Start
apfelwithapfel --serveorbrew services start apfel. - Open Visual Studio Code.
- Run
cliin your shell to authenticate Codex and update~/.continue/.env. - Restart the Visual Studio Code extension host.
- Ask Continue chat to review the current diff or selected code using the local
apfel-reviewmodel. - Once the review is clear, use Edit/Apply to hand the actual code change to the hosted
gpt-5.1-applymodel. - Run
clowhen you are done to clear the shell key and removeOPENAI_API_KEYfrom~/.continue/.env.
If Continue cannot talk to local apfel:
- make sure
apfel --serveis running - confirm the base URL is
http://127.0.0.1:11434/v1 - confirm the model name is
apple-foundationmodel - make sure the client is pointed at Chat Completions (
/v1/chat/completions)
If Continue cannot use the hosted edit/apply model:
- check that
~/.continue/.envcontainsOPENAI_API_KEY=... - run
cliagain after reloading~/.zshrc - restart the Visual Studio Code extension host
If you need a browser client instead of Continue:
- use
apfel --serve --cors --allowed-origins "<your local origin>"
For security and browser details, see server-security.md.
Kudos to @dan-snelson.