PentestGPT

Run PentestGPT's autonomous agent on Abliterator: point its Claude Code backend at a custom base URL, set the API key, pick a model and fix common errors.

Published PentestGPTPentestingClaude CodeAgents

Quick answer

PentestGPT's autonomous agent drives Claude Code, which accepts a custom Anthropic-compatible endpoint. Export ANTHROPIC_BASE_URL=https://abliterator.ai and your Abliterator key as ANTHROPIC_AUTH_TOKEN, pin Claude Code's model variables, then run pentestgpt-agent with --backend claude --model kimi-k3.1-pro-abliterated. This follows PentestGPT commit e8b1bb7.

How PentestGPT connects to a model

PentestGPT is an open-source penetration-testing agent from the authors of the USENIX Security 2024 paper of the same name. Its main branch ships two programs, and only one of them can reach Abliterator:

Program What it does How it calls a model Works with Abliterator
pentestgpt-agent The autonomous agent. A Supervisor picks one task at a time, an Executor carries it out with shell and file tools, and SQLite records every attempt and the evidence behind it Drives the Claude Code or Codex CLI through the unified-agent package Yes, with the Claude backend and ANTHROPIC_BASE_URL
pentestgpt-legacy The human-in-the-loop workflow from the 2024 paper Native SDKs for a fixed list of providers and models No. It accepts only its built-in model IDs or ollama:<model>, and the Ollama route sends a placeholder key

This guide follows the main branch at commit e8b1bb7 (July 2026), checked 2026-12-02. The configuration below was verified against that source code. The last tagged release, v1.0.0 from December 2025, used a different Docker-based setup.

Only for systems you own or have written permission to test. PentestGPT's agent README gives both roles full filesystem and process access and names "an isolated, disposable environment containing only authorized targets" as the supported deployment. Run it in a VM or container you can throw away.

Before you start

  • Python 3.12 or later and uv, from PentestGPT's prerequisites.
  • The Claude Code CLI (claude), installed per Claude Code's docs. You do not need to log in: the environment variables below authenticate it.
  • An Abliterator key from /keys. Create one for PentestGPT only, with a spend limit (authentication). The agent has a full shell in its environment, so treat the key as visible to it. New accounts get $10 of credit.
  • A target you own. For a first run, OWASP Juice Shop is an intentionally insecure web app made for security training. Its README starts it on the loopback interface only:
docker run --rm -p 127.0.0.1:3000:3000 bkimminich/juice-shop

Install PentestGPT

The README's install commands, pinned to the commit this guide was checked against (2026-07-14) instead of whatever main holds when you clone:

git clone https://github.com/GreyDGL/PentestGPT.git
cd PentestGPT
git checkout e8b1bb77d1ac00329675cec3b060aba971ec1ac8
make install

make install runs uv sync for the repository and uv sync --extra all inside pentestgpt_agent/, which installs the agent with its Claude Code and Codex adapters (Makefile).

The top-level README still shows a pentestgpt --target ... command. At this commit the agent's entry point is pentestgpt-agent, declared in pentestgpt_agent/pyproject.toml, and make run wraps it.

Point Claude Code at Abliterator

Export these in the shell you will run PentestGPT from:

export ANTHROPIC_BASE_URL="https://abliterator.ai"
export ANTHROPIC_AUTH_TOKEN="$ABL_API_KEY"
unset ANTHROPIC_API_KEY

export ANTHROPIC_MODEL="kimi-k3.1-pro-abliterated"
export ANTHROPIC_DEFAULT_OPUS_MODEL="kimi-k3.1-pro-abliterated"
export ANTHROPIC_DEFAULT_SONNET_MODEL="kimi-k3.1-pro-abliterated"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4.1-flash-abliterated"
export CLAUDE_CODE_SUBAGENT_MODEL="kimi-k3.1-pro-abliterated"
Variable Value Why
ANTHROPIC_BASE_URL https://abliterator.ai Claude Code appends /v1/messages, so leave /v1 off
ANTHROPIC_AUTH_TOKEN Your Abliterator key Sent as Authorization: Bearer
ANTHROPIC_MODEL and the ANTHROPIC_DEFAULT_*_MODEL variables Abliterator model IDs Claude Code resolves its opus, sonnet and haiku aliases through them. Unpinned, it sends a Claude model name and Abliterator returns 404
CLAUDE_CODE_SUBAGENT_MODEL kimi-k3.1-pro-abliterated The model for any subagent Claude Code starts

Two points are specific to PentestGPT:

  • Use shell exports. unified-agent starts Claude Code with setting_sources=["project"] (source), so the env block in ~/.claude/settings.json from our Claude Code guide is not read. The Claude Agent SDK passes the parent shell's environment to the Claude Code process, so exports work.
  • Do not set both keys. If ANTHROPIC_API_KEY holds a different key, requests carry two credentials and Abliterator rejects them.

Check the key and URL before you start an agent:

curl -sS https://abliterator.ai/v1/messages \
  -H "Authorization: Bearer $ABL_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model": "deepseek-v4.1-flash-abliterated", "max_tokens": 256, "messages": [{"role": "user", "content": "Reply with OK."}]}'

A JSON body with "type":"message" means both work.

Run a first assessment

From the pentestgpt_agent directory, in the same shell:

cd pentestgpt_agent
uv run pentestgpt-agent \
  --goal "Inventory the pages and services of this lab app and report likely weaknesses with evidence. Do not modify data." \
  --target http://127.0.0.1:3000 \
  --backend claude \
  --model kimi-k3.1-pro-abliterated \
  --max-decisions 5 \
  --run-id juice-shop-1

The flags, from trial.py:

Flag Meaning
--goal The objective in plain language. Required
--target An authorized target. Repeat it for several
--backend claude or codex. Use claude
--model Passed to Claude Code for both the Supervisor and the Executor
--max-decisions Supervisor decisions before the run stops. Default 20; keep it low for a first run
--supervisor-max-turns, --executor-max-turns Turn budgets per episode. Defaults 4 and 12
--effort Optional: low, medium, high, xhigh or max with the Claude backend. Leave it out at first
--run-id, --resume Name the run, and continue it later with exactly the same flags

The run writes to runs/: a summary.json for the run and, for each episode, input.json, events.jsonl and output.json. The README warns that these traces contain target output and are not encrypted, so store them like engagement data.

Confirm the requests reached Abliterator:

curl -s https://abliterator.ai/api/v1/activity -H "Authorization: Bearer $ABL_API_KEY" | head -c 600

At this commit, the agent README lists structured findings and report generation as future work. To draft the write-up, give summary.json and the relevant traces to kimi-k3.1-pro-abliterated with your report template; the cybersecurity use case shows the prompt pattern.

Choosing the model

PentestGPT sends one --model to both roles. Claude Code sends its background requests to the Haiku slot, which the exports above pin to deepseek-v4.1-flash-abliterated.

Model Use it for Notes
kimi-k3.1-pro-abliterated The default for the agent Long multi-step tool use. τ²-bench airline went from 86.7 to 87.3 after abliteration, within noise. Terminal-Bench 4.0 fell from 66.6 to 62.3, a drop that is plausible but not statistically shown (benchmarks), so try it on your lab target first
deepseek-v4.1-flash-abliterated Cheaper runs and practice Pass --model deepseek-v4.1-flash-abliterated and set every Claude Code model variable to it

Each turn resends the conversation. Abliterator caches the repeated prefix automatically, so most input on long runs bills at the cached price: $0.40 per 1M tokens on kimi-k3.1-pro-abliterated and $0.10 on deepseek-v4.1-flash-abliterated. See prompt caching.

Troubleshooting

Symptom Cause Fix
Claude Code is not authenticated: run claude /login or set ANTHROPIC_API_KEY The variables are not set in the shell that runs uv run Export ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN in that shell
401 Invalid credentials: send one abliterator key as `Authorization: Bearer` or `x-api-key`. ANTHROPIC_API_KEY is also set, to a different key unset ANTHROPIC_API_KEY
404 Model "claude-..." is not available on abliterator A Claude Code model alias is not pinned Set all the model variables above
effort for claude must be one of: high, low, max, medium, xhigh An unsupported --effort value Use one of those values, or leave --effort out
Codex runs fail with 404 The Codex CLI calls the Responses API Use --backend claude
429 Too many requests in flight Claude Code runs requests in parallel; the Free plan allows 2 at once Wait and resume, or use a plan with more concurrency
402 mid-run Credit or the key's spend limit ran out Add credit at /account, then rerun with --resume
--resume refuses to start Resume requires an exact match with trial-config.json, including model and effort Rerun with the original flags
The agent cannot reach the target 127.0.0.1 means the machine running the agent Run PentestGPT on the same host as the lab, or use the lab's address

If your sandbox allows egress only to Abliterator and the target, that is enough: PentestGPT already sets CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 for Claude Code, which stops its update checks and telemetry calls.

Frequently asked questions

Does PentestGPT work with an OpenAI-compatible API?

Only partly. The interactive pentestgpt-legacy mode speaks Chat Completions, but at commit e8b1bb7 it accepts only its built-in model IDs or ollama:<model>, and the Ollama route sends a placeholder key, so a hosted endpoint that checks keys rejects it. The autonomous agent uses Claude Code, which accepts an Anthropic-compatible base URL. That is the route this guide uses.

Where does PentestGPT read the API key from?

The autonomous agent reads no key itself. It starts Claude Code, which reads ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN from the environment. Export them in the shell that runs pentestgpt-agent. The agent loads only project-level Claude Code settings, so the env block in ~/.claude/settings.json is not used.

Can I use PentestGPT's Codex backend with Abliterator?

No. Current Codex CLI versions need the OpenAI Responses API, which Abliterator does not serve. Use --backend claude.

Can PentestGPT use a local model?

The legacy mode runs local Ollama models with ollama:<model> and --base-url. The autonomous agent needs an endpoint that serves the Anthropic Messages API, which Abliterator does at https://abliterator.ai.

Try it in your browser.

Ask it something your usual model refuses.

Start a chat

No sign-up to try. $10 free when you verify your email.