This guide covers installing Codex CLI, configuring it to use the local DFlash server, and common usage patterns.
- DFlash server built and model files downloaded (see DEVELOPER.md)
- Node.js ≥ 18
npm install -g @openai/codex
codex --version # should print 0.1xx.xIf you get a permission error, use a user-level prefix:
mkdir -p ~/.npm-global && npm config set prefix ~/.npm-global export PATH=~/.npm-global/bin:$PATH # add to ~/.bashrc npm install -g @openai/codex
cd dflash
./build/dflash_server models/Qwen3.6-27B-Q4_K_M.gguf \
--draft models/draft/draft-Qwen3.6-27B.gguf \
--port 8080Wait until you see:
[server] listening on 0.0.0.0:8080
curl -s http://localhost:8080/v1/responses \
-H "Content-Type: application/json" \
-d '{"model":"luce-dflash","input":"Say hi","max_output_tokens":32}' \
| python3 -m json.toolCreate or edit ~/.codex/config.toml:
model = "luce-dflash"
model_provider = "dflash"
[model_providers.dflash]
name = "DFlash"
base_url = "http://localhost:8080/v1"
wire_api = "responses"
supports_websockets = falseKey points:
| Field | Why |
|---|---|
name |
Required — Codex rejects providers with an empty name |
wire_api = "responses" |
Codex only supports the Responses API |
supports_websockets = false |
DFlash serves HTTP only |
No env_key |
Local server needs no auth token |
codex # opens the TUI# Simple question
codex exec "What is 2+2?"
# Coding task in a repo
cd /path/to/your/project
codex exec "Add input validation to the login handler"
# Code review
codex exec reviewcodex --approval-policy suggest ... # suggest commands, ask before running
codex --approval-policy auto-edit ... # auto-approve file edits, ask for shell
codex --approval-policy full-auto ... # auto-approve everythingThe server maps reasoning effort to Qwen's thinking mode:
low(default) — thinking disabled, fastest responsesmedium/high— thinking enabled (<think>tags)
codex -c 'model_reasoning_effort="medium"' exec "Refactor this module"Add name = "DFlash" (or any non-empty string) to [model_providers.dflash].
The server is returning an error. Check:
- Server is running —
curl http://localhost:8080/health - Port matches config —
base_urlmust match--port - Server logs — look at the terminal where
dflash_serveris running
Common causes:
- Server not started yet (daemon still loading model)
- Port mismatch between config and server
- Proxy intercepting localhost (set
no_proxy=localhost)
This warning is normal — Codex doesn't recognize custom model names but uses fallback metadata. It does not affect functionality.
The first request triggers model loading into GPU memory. Subsequent requests reuse the loaded model and are much faster.
./build/dflash_server <model.gguf> [OPTIONS]
Options:
--host HOST Bind address (default: 0.0.0.0)
--port PORT Bind port (default: 8080)
--draft PATH Draft model for speculative decoding
--ddtree-budget N Speculation budget (default: 64)
--max-ctx N Max context length (default: 131072)