Installation & Setup

Get Injectprompt CLI running in under a minute.

bash
curl -fsSL https://cli.injectprompt.com/install | bash
powershell
powershell -c "irm https://cli.injectprompt.com/install.ps1 | iex"

If injectprompt is not found after install, add the install directory to your Windows user PATH and restart your terminal:

powershell
[Environment]::SetEnvironmentVariable('PATH', $env:PATH + ';' + "$env:USERPROFILE\.local\bin", 'User')

After installation completes, start the CLI with:

bash
injectprompt

Before your first attack: open the InjectPrompt platform to sign in with Google, add credits to your account, and review the CLI key generated for this machine: https://platform.injectprompt.com/

Target Model Providers

During setup, you can point the target AI at any OpenAI-compatible provider. Common options include:

Provider Base URL Example Model
Gemini https://generativelanguage.googleapis.com/v1beta/openai/ gemini-2.5-flash
OpenAI https://api.openai.com/v1 gpt-5.4
Anthropic https://api.anthropic.com/v1 claude-opus-4-6
OpenRouter https://openrouter.ai/api/v1 openai/gpt-5.4
Local (Ollama) http://localhost:11434/v1 llama3.1

InjectPrompt can also be used to evaluate proprietary or internally hosted models before production deployment, helping teams assess prompt-injection resilience, policy compliance, and other adversarial behaviors during pre-release safety testing.

Configuration (Optional)

Open your global config quickly

Once your CLI config has been initialized, you can open the active global config file directly with:

bash
injectprompt config

This opens the active global config file in your operating system's default app for JSON files.

Use it whenever you want to review global defaults, your saved InjectPrompt authentication settings, or the currently active model settings without manually browsing to the config directory.

Config locations & priority

Injectprompt CLI loads and merges configs from multiple places. Later sources override earlier ones:

Priority Location Purpose
1 (lowest) Built-in defaults Sane out-of-the-box defaults
2 ~/.config/injectprompt/injectprompt.json Global preferences (API key, model, etc.)
3 (highest) ./injectprompt.json Per-project attack settings (committed to repo)
💡 Recommended setup: Put your LLM credentials in the global config so they apply everywhere, and keep attack-specific settings in the per-project config.

Full config schema

json — injectprompt.json (all fields)
{
  "max_attempts": 10,
  "red_team_ai": {
    "api_key": "Optional if you already authenticated with injectprompt auth login",
    "adversarial_goal": "What the attacker should achieve",
    "ask_goal_each_run": "yes",
    "model": "InjectPrompt model alias for the attacker (for example lite-3.0 or pro-3.0)"
  },
  "judge_ai": {
    "model": "Judge model alias (for example cli-judge)"
  },
  "blue_team_ai": {
    "system_prompt": "Optional target AI system prompt to test against",
    "api_key": "API key for the target provider",
    "base_url": "API endpoint for the target (any OpenAI-compatible URL)",
    "model": "Model ID for the target provider"
  }
}

Need the list of available InjectPrompt attacker models for red_team_ai.model? See the API docs: https://developers.injectprompt.com/api/docs

Commands

Use these commands to run the CLI again, reconfigure your setup, inspect saved settings, review history, or manage authentication later.

bash
# Run an attack
injectprompt

# Re-run guided setup anytime
injectprompt onboard

# Open the active global config json file in your default text editor
injectprompt config

# Browse local history
injectprompt history

# Check authentication status
injectprompt auth status

# Sign in again
injectprompt auth login

# Logout
injectprompt auth logout

Troubleshooting

"No valid LLM API key found"

Make sure authentication is set up for the provider you want to use.

  • For InjectPrompt API usage, purchase credits at https://platform.injectprompt.com/ and run injectprompt auth login
  • For external targets, configure that provider's API key in your CLI config

Config not loading

Config type Expected path
Global ~/.config/injectprompt/injectprompt.json
Project ./injectprompt.json (current directory)

Ensure valid JSON syntax — use jq . injectprompt.json to check.

Need to edit the global config?

Run injectprompt config to open the active global config file in your default editor/app for JSON files. If you want the CLI to walk you through the same values interactively again, use injectprompt onboard.

bash
injectprompt config
bash
injectprompt onboard

PATH issues after install

bash
echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.bashrc
source ~/.bashrc

Uninstall

Remove the Injectprompt CLI binary and global config from your system.

macOS, Linux, WSL

bash
rm -f ~/.local/bin/injectprompt
rm -f /usr/local/bin/injectprompt
rm -rf ~/.config/injectprompt

Windows PowerShell

powershell
Remove-Item -Path "$env:USERPROFILE\.local\bin\injectprompt.exe" -Force
Remove-Item -Path "$env:USERPROFILE\.config\injectprompt" -Recurse -Force -ErrorAction SilentlyContinue