OpenAI/Codex/CLI/How To/Get Started with mise and op the 1Password CLI
Properties
- tags
- Diataxis/How To
How To get started with OpenAI Codex CLI using mise/tasks and 1Password/Dev/op/run
Goal
Preconditions
Procedure
1. Configure global
~/.config/mise/config.toml- Create or update to include:toml
# ~/.config/mise/config.toml [tools] node = "lts" npm = "latest" # Ensure we have latest npm for package management [tasks.codex] description = "Run Codex CLI with OPENAI_API_KEY from 1Password" run = "op run -- npx @openai/codex $@" alias = "cx" dir = "{{cwd}}" # Run in current directory env = { OPENAI_API_KEY = "op://vault/default-openai-key/credential" } - This configuration:
- Create or update to include:
2. (Optional) Override at project level
- In your project's
.mise.toml, you can override the API key or other settings:toml[tasks.codex] # Override with a different API key for this project env = { OPENAI_API_KEY = "op://vault/project-specific-openai-key/credential" } # Or add project-specific arguments run = "op run -- npx @openai/codex --model=gpt-4 $@" - Project-level settings will take precedence over global settings
- You can override any task property:
env,run,description, etc.
- In your project's
3. Install dependencies
4. Try a sample prompt
Troubleshooting
References