Two files needed to make DeepSeek work properly with Codex CLI:
model = "deepseek-reasoner"
model_provider = "deepseek-reasoner"
approval_policy = "on-failure"
sandbox_mode = "workspace-write"
project_doc_max_bytes = 32768
[model_providers.deepseek-reasoner]
name = "DeepSeek Reasoner"
base_url = "https://api.deepseek.com/v1"
env_key = "DEEPSEEK_API_KEY"
wire_api = "chat"
request_max_retries = 3
stream_max_retries = 5
stream_idle_timeout_ms = 180000
[model_providers.deepseek-chat]
name = "DeepSeek Chat"
base_url = "https://api.deepseek.com/v1"
env_key = "DEEPSEEK_API_KEY"
wire_api = "chat"
request_max_retries = 4
stream_max_retries = 8
stream_idle_timeout_ms = 120000
[profiles.deepseek-reasoner]
model = "deepseek-reasoner"
model_provider = "deepseek-reasoner"
approval_policy = "on-failure"
sandbox_mode = "workspace-write"
model_supports_reasoning_summaries = false
[profiles.deepseek-chat]
model = "deepseek-chat"
model_provider = "deepseek-chat"
approval_policy = "on-failure"
sandbox_mode = "workspace-write"
model_supports_reasoning_summaries = false
[sandbox_workspace_write]
exclude_tmpdir_env_var = false
exclude_slash_tmp = false
network_access = true
[shell_environment_policy]
inherit = "all"
ignore_default_excludes = false
[history]
persistence = "save-all"# Agent Instructions for Codex CLI
## DeepSeek Models Critical Instructions
### IF YOU ARE A DEEPSEEK MODEL:
**CRITICAL**: DeepSeek models MUST use the shell function for ALL command execution.
#### Shell Command Execution
- **ALWAYS** use the `shell` function to execute commands
- **NEVER** call commands directly
- Syntax: `shell(cmd=["bash", "-lc", "command"], workdir="path")`
Examples:
- List files: `shell(cmd=["bash", "-lc", "ls -la"], workdir=".")`
- Read file: `shell(cmd=["bash", "-lc", "cat filename"], workdir=".")`
- Search: `shell(cmd=["bash", "-lc", "rg 'pattern'"], workdir=".")`
#### File Operations
- Use provided file operation tools when available (read_file, write_file)
- Otherwise use shell commands through the shell function
### Working Directory
- Always set the `workdir` parameter when using shell function
- Use absolute paths or specify workdir instead of `cd`
### For All Models
- Respect sandbox mode settings
- Follow approval policy
- Handle errors gracefully- Set API key:
export DEEPSEEK_API_KEY="your-key"- Place config.toml in ~/.codex/config.toml
- Place AGENTS.md in ~/.codex/AGENTS.md