A bamboo ladder leaning against a building in Haikou, with the article title about using HackingBuddyGPT with a custom LLM API
Cover based on a photo by RedRouter, Original; Anna Frodesiak, via Wikimedia Commons, CC0 1.0

HackingBuddyGPT is an MIT-licensed Python framework for LLM-driven security testing agents. Its README and .env.example document an OpenAI-compatible custom API base through llm.api_base, with defaults aimed at OpenRouter. This guide shows how to run HackingBuddyGPT with an OpenAI-compatible API such as RedRouter, which config keys actually exist today, why llm.api_base alone does not move traffic on the current main tip, and the OPENAI_API_BASE plus openai/ model-prefix path that did.

What we checked, on November 23, 2026 (America/Denver): the repository at commit e23d918 (October 24, 2026; package version 0.5.0), .env.example, src/hackingBuddyGPT/utils/llm.py, the backends page at docs.hackingbuddy.ai, and the latest GitHub release tag v0.5.0 (August 27, 2025). We installed the project with uv sync into a local venv under /workspace/seo/hbgpt-lab, listed every wintermute use-case, and ran wintermute MinimalPrivEscLinux --help to confirm the live flag names. Model traffic for the API-base checks went to a local mock OpenAI-compatible server on 127.0.0.1. One WebTestingWithExplanation run used that mock plus a throwaway web lab we bound to 127.0.0.1:8787. We did not run a Linux privilege-escalation use-case against a live SSH target (no throwaway VM or container was available on the test box), and we did not call RedRouter with a real API key. Treat the RedRouter steps as a recipe; the CLI and routing behavior below is what we saw.

Use HackingBuddyGPT only against systems you own, an isolated lab or VM, or targets you have written permission to test. Its own README warns that it executes real commands on live systems. Privilege-escalation use-cases are built for that job: keep them in an isolated lab.

What HackingBuddyGPT is

HackingBuddyGPT ships the wintermute CLI. Running it with no arguments lists the registered use-cases. On our install those were:

Use-caseRole
MinimalPrivEscLinuxShort Linux privilege-escalation loop over SSH
MinimalToolCallPrivEscLinuxTool-calling Linux privilege escalation with ground-truth root checks
PrivEscLinuxStrategy-based Linux privilege escalation (optional RAG, CoT, state)
PrivEscWindowsWindows privilege escalation over psexec
ExPrivEscLinuxLSERuns lse.sh first, then drives PrivEscLinux
WebTestingWithExplanation / WebTestingWithShell / AdvancedWebTestingWeb testing agents
WebAPITestingOpenAPI or sitemap discovery, then API pentest
ADActive Directory assumed-breach planner/executor

Every use-case that talks to a model goes through one upstream: litellm. The README's Linux privilege-escalation benchmark and the paper LLMs as Hackers are the research backdrop; this post is about pointing that upstream at a custom OpenAI-compatible base URL.

If you only need the short env-var block next to other clients, our OpenAI-compatible API guide for security agents has it. Sibling setup notes for other agents live in Strix with an OpenAI-compatible API. For CTF-style loops rather than this framework, see LLM for CTF challenges.

Config keys for a HackingBuddyGPT OpenAI-compatible API

Configuration stacks four layers: process environment, a .env file, optional --config config.json, then CLI flags. Any option you can pass on the command line can also sit in .env. On wintermute MinimalPrivEscLinux --help the LLM-related keys were:

KeyWhat it is
llm.api_keyUpstream API key (secret)
llm.modelModel name in litellm format
llm.context_sizeMax context used for prompt trimming
llm.api_baseDocumented base URL; default https://openrouter.ai/api
llm.api_timeout / llm.api_retriesPer-request timeout and retry count
llm.providerOpenRouter provider routing only
llm.proxy / llm.proxy_insecureOptional intercepting proxy

.env.example on main matches those names and comments that the default endpoint is OpenRouter. The backends docs page still shows llm.api_url in places; on our build --llm.api_url=... was rejected as Invalid argument. Use llm.api_base.

A minimal RedRouter-shaped .env looks like this:

llm.api_key='YOUR_REDROUTER_KEY'
llm.model='openai/glm-5.3-flash-red'
llm.context_size=128000
llm.api_base='https://redrouter.org/v1'

The openai/ prefix matters. litellm needs a provider prefix for a non-catalog model ID; a bare glm-5.3-flash-red failed for us with LLM Provider NOT provided even when api_base was passed into litellm directly. RedRouter's OpenAI-compatible base URL is https://redrouter.org/v1 per the compatibility docs.

The gotcha: llm.api_base is documented, then ignored

In src/hackingBuddyGPT/utils/llm.py on commit e23d918, LiteLLM.api_base is a real parameter with the OpenRouter default, and wintermute --help prints it. The call that actually talks to the network looks like this:

return litellm.completion(
    model=self.model,
    messages=messages,
    tools=tools,
    tool_choice=tool_choice,
    # api_base=self.api_base, TODO: why is this not working anymore
    api_key=self.api_key,
    timeout=self.api_timeout,
    num_retries=self.api_retries,
    extra_body=extra_body,
)

The api_base= line is commented out. The project's own benchmark_privesc.py notes the same gap and routes Ollama through OLLAMA_API_BASE instead.

We proved it against two local mock servers:

  1. Set llm.api_base=http://127.0.0.1:8765/v1 and llm.model=openai/glm-5.3-flash-red in .env, left OPENAI_API_BASE unset, and started WebTestingWithExplanation for one round. The mock log stayed empty. litellm raised AuthenticationError from platform.openai.com for the fake key rr-lab-key.
  2. Exported OPENAI_API_BASE=http://127.0.0.1:8765/v1 with the same openai/ model prefix and ran again. The mock received POST /v1/chat/completions with Authorization: Bearer … and the model ID stripped of the prefix.

So on this tip, setting a HackingBuddyGPT custom API base through llm.api_base alone does not move traffic. The documented key is still the right place to record your intended base, and uncommenting api_base=self.api_base in raw_completion restored routing when we patched it in-process. Until that lands upstream, the portable workaround is litellm's own OpenAI environment:

export OPENAI_API_BASE='https://redrouter.org/v1'
# optional alias some clients prefer:
# export OPENAI_BASE_URL='https://redrouter.org/v1'

Keep llm.api_key as your RedRouter key and llm.model as openai/<catalog-id>. Re-check llm.py after you pull; if the TODO is gone, llm.api_base should be enough on its own.

Run it against a lab you own

Privilege-escalation use-cases take an SSH target (--conn.host, --conn.username, --conn.password or a key). The README also documents a local_shell tmux connector for development; on our tip the Linux privilege-escalation classes type their connector as SSHInteractiveConnection, so plan on a VM or container you control. The project's Linux Privilege-Escalation Benchmark is the intended practice set.

Example for an isolated SSH lab once the model path above is working:

wintermute MinimalPrivEscLinux \
  --llm.api_key="$REDROUTER_API_KEY" \
  --llm.model='openai/glm-5.3-flash-red' \
  --llm.context_size=128000 \
  --llm.api_base='https://redrouter.org/v1' \
  --limits.max_rounds=20 \
  --limits.max_cost=2.0 \
  --conn.host=192.168.122.151 \
  --conn.username=lowpriv \
  --conn.password='…' \
  --conn.hostname=labbox

Export OPENAI_API_BASE=https://redrouter.org/v1 in that shell until api_base is wired again. Cap rounds and cost so a stuck loop cannot spend freely. For tool-calling agents (MinimalToolCallPrivEscLinux and several web use-cases), pick a RedRouter model that lists tool calling — both options below do.

What we actually ran on the test box: WebTestingWithExplanation for two rounds against http://127.0.0.1:8787, with OPENAI_API_BASE aimed at the mock and llm.api_base still set to the RedRouter URL (ignored for routing). The mock answered twice; the run stopped with Reached maximum rounds (2). No packets left loopback for the target. That is enough to show the OpenAI-compatible path; it is not a privilege-escalation result.

Authorized scope still matters more than the model. RedRouter's /security and /scope pages are the product boundaries; pointing wintermute at a host does not create permission. For a longer authorized-pentest framing around red-cyber-1, see red-cyber-1 for authorized pentest workflows.

Which model to use with HackingBuddyGPT

Prices are from docs.redrouter.org/models on November 23, 2026:

  • GLM 5.3 Flash Red (glm-5.3-flash-red): $0.25 input, $0.13 cached input, $1.00 output per 1M tokens. A practical default for short, repeated agent rounds.
  • red-cyber-1 (red-cyber-1): $0.28 input, $0.13 cached input, $1.10 output per 1M tokens. The model RedRouter features for authorized penetration testing and red-team work.

Both list a 1,048,576-token context window, tool calling and structured output on their model pages. Set llm.context_size to the trimming budget you want the agent to use; it does not have to equal the full window. Plans are on /pricing. Token rates stay on the model pages and docs.redrouter.org/models.

Where the data goes

HackingBuddyGPT writes per-run JSONL traces under the configured log.log_dir (default logs/) on your machine. Every model call can carry shell output, web responses and credentials from the target. On RedRouter's side, zero data retention is an opt-in setting, off by default; the data handling docs explain the controls, and What RedRouter keeps covers the defaults. Send only what your engagement terms allow, and treat local log files as in-scope evidence you must scrub under those same terms.

FAQ

Does HackingBuddyGPT work with an OpenAI-compatible API? Yes. It talks to models through litellm. Use an openai/ model prefix, your key in llm.api_key, and a /v1 base URL. On the tip we tested, set OPENAI_API_BASE as well because llm.api_base is not passed into litellm.completion yet.

How do I set a HackingBuddyGPT custom API base? Documented key: llm.api_base in .env, JSON config or --llm.api_base=…. Working path today: export OPENAI_API_BASE=https://redrouter.org/v1 (or uncomment api_base=self.api_base in utils/llm.py). Do not use llm.api_url; the CLI rejects it.

Which keys are llm.api_base, llm.api_key, llm.model and llm.context_size? Those four are the ones .env.example and --help agree on for the upstream. llm.provider is OpenRouter routing only; leave it empty for RedRouter.

Which use-cases call the custom base? All of them share the same LiteLLM upstream, so privilege-escalation, web, web-API and AD use-cases inherit the same base once routing works.

Do I need tool calling? Text-strategy use-cases such as MinimalPrivEscLinux parse a command out of the reply. Tool-calling use-cases such as MinimalToolCallPrivEscLinux need native function calling. RedRouter's Chat Completions path supports tools for the models above; see the compatibility and chat completions docs.

Can I point it at a production host to try one round? No. Keep privilege-escalation and web agents inside an isolated lab or a target with written authorization. Cap --limits.max_rounds and --limits.max_cost even there.

Sources

  • HackingBuddyGPT repository and README: https://github.com/ipa-lab/hackingBuddyGPT
  • HackingBuddyGPT, .env.example: https://github.com/ipa-lab/hackingBuddyGPT/blob/main/.env.example
  • HackingBuddyGPT, utils/llm.py (LiteLLM upstream): https://github.com/ipa-lab/hackingBuddyGPT/blob/main/src/hackingBuddyGPT/utils/llm.py
  • HackingBuddyGPT backends docs: https://docs.hackingbuddy.ai/docs/introduction/backends
  • HackingBuddyGPT release v0.5.0: https://github.com/ipa-lab/hackingBuddyGPT/releases/tag/v0.5.0
  • Linux Privilege-Escalation Benchmark: https://github.com/ipa-lab/benchmark-privesc-linux
  • Happe and Cito, "LLMs as Hackers: Autonomous Linux Privilege Escalation Attacks": https://arxiv.org/abs/2310.11409
  • litellm OpenAI-compatible providers: https://docs.litellm.ai/docs/providers/openai_compatible
  • RedRouter docs, OpenAI and Anthropic API compatibility: https://docs.redrouter.org/compatibility
  • RedRouter docs, Chat Completions: https://docs.redrouter.org/chat-completions
  • RedRouter docs, Models and pricing: https://docs.redrouter.org/models
  • RedRouter docs, Data handling: https://docs.redrouter.org/data-handling
  • RedRouter model list: https://redrouter.org/v1/models