Local Setup with Visual Studio Code
April 11, 2026 ยท View on GitHub
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.
1. Start apfel as the local server
Use apfel as the local OpenAI-compatible base URL:
http://127.0.0.1:11434/v1
Start it in the foreground:
apfel --serve
Or run it in the background:
brew services start apfel
Background-service details: background-service.md
Important: use Chat Completions, not the newer Responses API. apfel supports POST /v1/chat/completions and does not implement POST /v1/responses.
2. Install the Continue extension in Visual Studio Code
Use Continue as the Visual Studio Code front end.
Continue reads configuration from:
~/.continue/config.yaml~/.continue/.env
3. Configure Continue with two models
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: file
Why 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: 4096matchesapfel's local context budget.
4. Provide OPENAI_API_KEY to Continue
Continue reads secrets from ~/.continue/.env.
The direct manual version is:
OPENAI_API_KEY=your_openai_api_key_here
But 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.)
5. Sync ~/.continue/.env automatically from ~/.zshrc
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
That means your typical flow becomes:
source ~/.zshrc
cli
When you are done with the Visual Studio Code session:
clo
This keeps the Continue secret in step with the rest of your Codex/OpenAI shell workflow without requiring manual edits to ~/.continue/.env each time.
6. Restart Visual Studio Code after auth changes
After 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
7. Recommended day-to-day usage
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.
8. Typical workflow
- 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.
9. Troubleshooting
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 using Chat Completions, not Responses
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.