Xalgorix is an open-source AI penetration testing agent written in Go, and it can run on any OpenAI-compatible API. The documented setup is three lines: XALGORIX_LLM=custom/<model>, XALGORIX_API_BASE pointing at the provider's /v1 URL, and XALGORIX_API_KEY. This guide covers the Xalgorix OpenAI-compatible setup with RedRouter: what each variable does in the code, how the model prefix decides where your key goes, what the agent sends to a custom provider, and why a scan with a broken LLM config can still end with "No vulnerabilities found."
What we checked, on November 30, 2026 (America/Denver): release v4.6.213 (tagged November 28 at 10:30 PM MT; commit 7108346b on main), the README, the official docs, and the config and LLM client code under internal/config and internal/llm. The repository now lives at github.com/xalgorix/xalgorix; the old github.com/xalgord/xalgorix URL redirects there, and the Go module path is still github.com/xalgord/xalgorix/v4. The project is Apache-2.0 and had 1,542 stars that morning. It ships releases almost daily, so re-check variable names against the version you install.
We built the CLI from source with Go 1.27.3 (go build ./cmd/xalgorix, without rebuilding the web UI) and ran it in an isolated home directory with auto-install and the browser turned off and a three-iteration cap. Every scan targeted a static page we served on 127.0.0.1:18081. Model traffic went either to a small mock OpenAI-compatible server on 127.0.0.1 or to https://redrouter.org/v1 with a fake key. The mock never returned a tool call, so no scan executed a tool. We didn't call RedRouter with a real key, didn't run the Docker image, and didn't use the web dashboard. One misconfigured run sent the fake key to api.openai.com; that's covered below because it's the main thing to avoid.
Use Xalgorix only against systems you own or have written permission to test. Its docs say the same, and its terminal tool runs real commands.
What Xalgorix is
Xalgorix is a Go binary with a local web dashboard on 127.0.0.1:9137 and a CLI. An LLM agent with a terminal and a browser works through a 22-phase test plan for web apps and APIs and drives tools such as Nmap, Nuclei and sqlmap. The part that got it press is the verifier. Help Net Security's November 23 feature describes it as a separate agent role that starts from a fresh context, gets read-only tools, and has to re-exploit a finding before it's reported. The same article quotes the maintainer on model choice: "A full run is a long chain of tool calls, and weaker models start producing malformed tool calls or lose track of state as the context grows."
That quote is the reason the endpoint setup matters more than usual. A long scan makes hundreds of calls, each one carries a large system prompt, and the tool-call format your model has to produce depends on a setting most people never touch.
The CLI flags we used come from xalgorix --help on the build:
-t, --target <url> Target URL, IP, or local path (repeatable)
-i, --instruction <text> Custom instructions for the agent
-m, --model <name> LLM model (overrides XALGORIX_LLM)
--setup Configure provider, model, and API key interactively
-w, --web Launch the Web UI dashboard
Xalgorix OpenAI-compatible settings: XALGORIX_API_BASE and the custom/ prefix
The README and docs give the same custom provider example:
XALGORIX_LLM=custom/security-model
XALGORIX_API_BASE=https://your-provider.example/v1
XALGORIX_API_KEY=your_provider_api_key
Xalgorix reads configuration from /etc/xalgorix.env, then ~/.xalgorix.env, then the process environment, with later sources winning. These are the settings that matter for a custom provider on v4.6.213:
| Setting | Default | What it does |
|---|---|---|
XALGORIX_LLM | none (required) | Model with a provider prefix. custom/ selects the generic OpenAI-compatible path and is stripped before the request. |
XALGORIX_API_BASE | provider default | The docs call it "Custom OpenAI-compatible API base URL." Xalgorix appends /chat/completions. |
XALGORIX_API_KEY | none (required) | Sent as Authorization: Bearer .... The CLI exits with XALGORIX_API_KEY is required if it's missing. |
XALGORIX_API_KEYS | none | Extra keys, comma-separated, rotated on rate limits. |
XALGORIX_NATIVE_TOOL_CALLS | false | Sends tools as an OpenAI tools array instead of asking the model to write XML tags in its text. In the source and the dashboard's Settings editor, not in the docs site's variable list. |
XALGORIX_MAX_OUTPUT_TOKENS | 8192 | Per-call max_tokens. |
XALGORIX_LLM_CONTEXT_WINDOW | 128000 | When auto-compaction kicks in. The Settings text says to set it to the model's real window. |
XALGORIX_SYSTEM_PROMPT_CORE_ONLY | false | New in PR #942: after a short warm-up, send a compact core prompt instead of the full methodology on every call. |
The prefix is not cosmetic. The docs list openai/, anthropic/, deepseek/, groq/, google/, gemini/, ollama/ and minimax/ with their own default base URLs, and custom/ with none. That difference is what makes custom/ the safe choice, as the next section shows.
How Xalgorix routes the model string
We ran the same three-iteration CLI scan with different combinations and read both the mock's request log and the [llm] Request → line Xalgorix prints before each call:
XALGORIX_LLM | XALGORIX_API_BASE | Where the request went | Model sent |
|---|---|---|---|
custom/glm-5.3-flash-red | mock /v1 | mock | glm-5.3-flash-red |
openai/glm-5.3-flash-red | mock /v1 | mock | glm-5.3-flash-red |
glm-5.3-flash-red (no prefix) | mock /v1 | mock | glm-5.3-flash-red |
custom/glm-5.3-flash-red | unset | nowhere: no API base URL for provider "custom": set XALGORIX_API_BASE to the endpoint its API key belongs to | none |
glm-5.3-flash-red (no prefix) | unset | https://api.openai.com/v1/chat/completions with our key | glm-5.3-flash-red |
custom/glm-5.3-flash-red, no key | mock /v1 | nowhere: config error, exit 1 | none |
With the base URL set, all three model strings reach your endpoint with the prefix removed. The difference shows up when the base URL goes missing, for example when a systemd unit doesn't load the env file you tested with, or someone comments out a line. With custom/, Xalgorix refuses to send anything. With a bare model ID, it falls back to OpenAI's API and sends whatever key you configured. In our run that was a fake key and OpenAI answered with a 401, but with a real RedRouter key you'd be sending it to a third party. Always use custom/ for RedRouter.
What Xalgorix sends to a custom provider
With custom/glm-5.3-flash-red and the base pointed at the mock, the mock logged one request per iteration. The first one, Authorization redacted:
{"method": "POST", "path": "/v1/chat/completions", "authorization": "Bearer <redacted, 19 chars>", "user_agent": "Go-http-client/1.1", "model": "glm-5.3-flash-red", "stream": false, "keys": ["max_tokens", "messages", "model", "stream", "temperature"], "max_tokens": 8192, "temperature": 0, "roles": ["system", "user"], "system_prompt_chars": 173942, "tools": []}
Turning on XALGORIX_NATIVE_TOOL_CALLS=true changed the request:
{"method": "POST", "path": "/v1/chat/completions", "model": "glm-5.3-flash-red", "stream": false, "keys": ["max_tokens", "messages", "model", "stream", "temperature", "tools"], "max_tokens": 8192, "temperature": 0, "system_prompt_chars": 109241, "tools": ["add_hypothesis_evidence", "add_note", "authz_matrix", "browser_action", "...", "verify_sqli", "verify_ssti", "wait_agent", "web_search"]}
What that tells you:
- Plain Chat Completions, no streaming. Every call was
POST /v1/chat/completionswithstream: false,max_tokens: 8192andtemperature: 0. RedRouter acceptsmax_tokenson Chat Completions and caps larger values at the model's maximum, per the compatibility docs. Both models below list a 33K max output. - Tools live in the text by default. Without the native flag there's no
toolsfield. The system prompt tells the model that every response must contain an XML tool call such as<function=terminal_execute>..., and Xalgorix parses calls out of the reply text. With the flag on, the 49 tools go out as a JSON-schematoolsarray and the system prompt drops from 173,942 to 109,241 characters. The source comment says the native path exists because models that weren't trained on the XML dialect "answer in prose and never call a tool." - The system prompt is big. 173,942 characters is a lot of input on every call. The PR #942 description puts the static methodology at about 30K tokens and "roughly half of each call." We turned on
XALGORIX_SYSTEM_PROMPT_CORE_ONLYtoo, and the prompt stayed the same size in our runs. That's expected: the PR says the full prompt is re-sent whenever a turn returns no tool call, and our mock never returned one. We couldn't measure what the flag saves on a real scan. - The prompt asserts authorization and states scope. It opens with "This is a SANCTIONED, AUTHORIZED penetration test" and, for our target, added: "127.0.0.1 is in scope ONLY on port 18081, the port the target URL names. Other ports on this host are separate services outside this engagement." The scope rule is enforced partly by the runtime and partly by the model, by the prompt's own account. Set targets carefully and use the dashboard's "Out of Scope" field when you have exclusions.
If you plan to send traffic through RedRouter, the tool calling docs describe how function tools work on Chat Completions.
The gotcha: a failed Xalgorix scan still says "No vulnerabilities found"
Next we broke the config on purpose and watched how each scan ended.
| Case | What Xalgorix printed | Exit code |
|---|---|---|
custom/..., base = https://redrouter.org/v1, invalid key | LLM error (attempt 1/25): LLM request failed: API returned 401: {"error":{"code":"invalid_api_key","message":"Missing, invalid, or revoked API key."...}} on each iteration, then ✅ Agent finished and No vulnerabilities found. | 0 |
custom/..., no XALGORIX_API_BASE | no API base URL for provider "custom" on each iteration, then No vulnerabilities found. | 0 |
| Answers once, then the provider returns 503 | LLM request failed after 3 retries: API returned 503 on each iteration, then No vulnerabilities found. | 0 |
XALGORIX_API_KEY unset | Configuration error: XALGORIX_API_KEY is required for the selected provider. | 1 |
Only the missing key stopped Xalgorix before the scan started. In the other cases, the agent loop kept iterating, never got a model reply, and closed with the same summary a clean scan would print. Our runs stopped at the three-iteration cap; the attempt counter (1/25) suggests an uncapped run keeps trying much longer, with waits between attempts. Xalgorix also lists the 401 as non-retryable, so it doesn't hammer the provider with each bad call, but it doesn't end the scan either.
There is one quiet tell. A scan that reached a model ends with a line like ═══ LLM usage this scan: ~57 tokens ═══. The failed scans had no usage line at all, because the code prints it only when the token count is above zero. In a dashboard, the live feed shows these errors. In cron, CI or a systemd timer, an exit code of 0 and "No vulnerabilities found" can pass for a clean target.
A fail-closed preflight for Xalgorix
The fix is a tiny call with the same variables before the scan starts. This is the xalgorix-preflight.sh we ran. It enforces the custom/ prefix, so a bare model ID can never fall back to OpenAI:
#!/usr/bin/env bash
# xalgorix-preflight.sh: fail closed unless the configured OpenAI-compatible endpoint answers.
set -euo pipefail
[ -f "$HOME/.xalgorix.env" ] && { set -a; . "$HOME/.xalgorix.env"; set +a; }
llm="${XALGORIX_LLM:-}"; base="${XALGORIX_API_BASE:-}"; key="${XALGORIX_API_KEY:-}"
case "$llm" in custom/?*) ;; *) echo "FAIL: XALGORIX_LLM='$llm' should be custom/<model-id>"; exit 1;; esac
[ -n "$base" ] || { echo "FAIL: XALGORIX_API_BASE is not set"; exit 1; }
[ -n "$key" ] || { echo "FAIL: XALGORIX_API_KEY is not set"; exit 1; }
model="${llm#custom/}"
code=$(curl -sS -o /tmp/xalgorix-preflight.json -w '%{http_code}' --max-time 60 \
"${base%/}/chat/completions" \
-H "Authorization: Bearer $key" -H "Content-Type: application/json" \
-d "{\"model\":\"$model\",\"messages\":[{\"role\":\"user\",\"content\":\"Reply with OK.\"}],\"max_tokens\":8}") || code=000
if [ "$code" != "200" ]; then echo "FAIL: HTTP $code from ${base%/}/chat/completions"; head -c 300 /tmp/xalgorix-preflight.json; echo; exit 1; fi
echo "OK: ${base%/} answered for model '$model'"
And a wrapper that also fails the scan if Xalgorix logs an LLM error after the preflight passed:
#!/usr/bin/env bash
# run-xalgorix.sh: preflight, then run Xalgorix and fail if any LLM call errored.
set -euo pipefail
"$(dirname "$0")/xalgorix-preflight.sh"
log=$(mktemp)
xalgorix "$@" 2>&1 | tee "$log"
if grep -q "LLM error" "$log"; then echo "FAIL: Xalgorix logged an LLM error; treat this scan as incomplete" >&2; exit 1; fi
Results from the lab:
### preflight vs local mock
OK: http://127.0.0.1:18080/v1 answered for model 'glm-5.3-flash-red'
exit 0
### preflight vs redrouter.org/v1, invalid key
FAIL: HTTP 401 from https://redrouter.org/v1/chat/completions
{"error":{"code":"invalid_api_key","message":"Missing, invalid, or revoked API key.","param":null,"type":"authentication_error"}}
exit 1
### preflight, bare model id
FAIL: XALGORIX_LLM='glm-5.3-flash-red' should be custom/<model-id>
exit 1
### preflight, custom/ without XALGORIX_API_BASE
FAIL: XALGORIX_API_BASE is not set
exit 1
### wrapper vs redrouter.org/v1, invalid key
FAIL: HTTP 401 from https://redrouter.org/v1/chat/completions
exit 1
### wrapper vs local mock that answers the preflight, then returns 503
OK: http://127.0.0.1:18082/v1 answered for model 'glm-5.3-flash-red'
⚠ Error: LLM error (attempt 1/25): LLM request failed after 3 retries: API returned 503: ...
No vulnerabilities found.
FAIL: Xalgorix logged an LLM error; treat this scan as incomplete
exit 1
The last case is the one the grep guard is for: the endpoint was fine at preflight time and failed mid-scan. The string matches the LLM error text in v4.6.213; if a later release rewords it, update the guard. The guard is strict on purpose. A long scan that hits one transient error and recovers will also be marked incomplete, which is the right default when the result is "no findings."
Xalgorix LLM setup with RedRouter
With the preflight in place, the RedRouter setup is the documented custom provider block with real values. RedRouter's OpenAI-compatible base URL is https://redrouter.org/v1, per the compatibility docs. Put this in ~/.xalgorix.env and keep the file readable only by you (chmod 600):
XALGORIX_LLM=custom/glm-5.3-flash-red
XALGORIX_API_BASE=https://redrouter.org/v1
XALGORIX_API_KEY=your-redrouter-api-key
XALGORIX_NATIVE_TOOL_CALLS=true
Two choices in there are judgment calls, so here's the reasoning:
XALGORIX_NATIVE_TOOL_CALLS=true. Both RedRouter models below list tool calling, and the native path removes the dependence on the model writing Xalgorix's XML dialect, which is the failure the maintainer describes on long runs. We could only confirm the request shape against the mock, not a live scan, so run one lab scan with it on and one with it off and compare the live feed for malformed calls before you standardize.XALGORIX_LLM_CONTEXT_WINDOW. We left it at the default. Both models have a 1M context, and the Settings text suggests setting the real window, but a higher value means compaction fires later and each call carries more history. On a metered API, the default 128,000 is the cheaper starting point.
Then run the preflight and start against a lab target you own:
./run-xalgorix.sh --target http://10.10.10.5:8080 \
--instruction "Test only http://10.10.10.5:8080. Do not touch other hosts or ports."
10.10.10.5:8080 stands in for an app in your own lab. If you prefer the dashboard, run the preflight and then xalgorix --web. Its Settings page has LLM settings and an environment variable editor for the same values.
About Docker: the compose file sets privileged: true, with a comment that the container "is meant to be a disposable, network-isolated scanning sandbox running as root." The image runs as root. Treat it that way: a throwaway VM or host on an isolated network, never your workstation and never next to anything you care about. We didn't run the image.
Which model to use with Xalgorix
A scan is many calls, and each one carries the system prompt, so input price dominates.
- GLM 5.3 Flash Red (
glm-5.3-flash-red): $0.25 per 1M input tokens, $0.13 per 1M cached input tokens and $1.00 per 1M output tokens, per docs.redrouter.org/models on November 30, 2026. Tool calling and JSON output are listed, with a 1M context and 33K max output. It's a practical default for high-volume agent turns. - red-cyber-1 (Beta,
red-cyber-1): $0.28 / $0.13 / $1.10 per 1M. It's the model RedRouter features for authorized penetration testing and red-team work. SetXALGORIX_LLM=custom/red-cyber-1.
To put the prompt size in numbers: if the static methodology is about 30K tokens, as PR #942 says, each call spends about $0.0075 on it with GLM 5.3 Flash Red at the uncached input rate, or about $0.0039 when the provider reports a cache read. That's roughly $0.75 or $0.39 per 100 calls before tool output, history and replies. This is arithmetic on the maintainer's estimate, not a measured scan. RedRouter bills only reported cache hits at the cached-input rate, and hits aren't guaranteed; prompt caching explains when they happen. Plans are on /pricing.
Where the data goes
Everything in that system prompt, plus tool output, HTTP responses from the target and saved notes, goes to the endpoint on every turn. On RedRouter, Zero Data Retention is an opt-in setting and off by default. The data handling docs explain what's stored and how to turn it on, and what RedRouter keeps is the short version. Our security page covers how we handle security workloads. Whatever the provider, keep client credentials you don't need out of the scan instructions and the target auth settings.
Other security agents with an OpenAI-compatible API
If you're comparing harnesses, the OpenAI-compatible API guide for security agents is the hub. We've also covered Strix, PentAGI and HackingBuddyGPT, each with its own prefix and base URL rules. If you'd rather keep the scanner deterministic and use a model only to sort findings, see Nuclei AI triage for bug bounty.
FAQ
Does Xalgorix support OpenAI-compatible APIs?
Yes. Set XALGORIX_LLM=custom/<model-id>, XALGORIX_API_BASE to the provider's /v1 URL and XALGORIX_API_KEY to that provider's key. For RedRouter that's https://redrouter.org/v1 and, for example, custom/glm-5.3-flash-red. Any endpoint that serves /v1/chat/completions works, per the docs.
Should I use custom/ or openai/ for a custom provider in Xalgorix?
Use custom/. With XALGORIX_API_BASE set, custom/, openai/ and a bare model ID all reached our endpoint with the prefix stripped. Without it, custom/ refused to send anything, while a bare model ID went to api.openai.com with our key.
Why does Xalgorix say "no API base URL for provider custom"?
XALGORIX_LLM starts with custom/ but XALGORIX_API_BASE isn't set in any file Xalgorix loaded. Check ~/.xalgorix.env, /etc/xalgorix.env and, for a service, the environment of the user it runs as. In our test the scan kept going and still ended with "No vulnerabilities found."
Should I turn on XALGORIX_NATIVE_TOOL_CALLS with RedRouter?
It's worth testing. It sends tools as an OpenAI tools array instead of XML in the prompt, and both RedRouter models list tool calling. We confirmed the request shape but not a full scan, so compare one lab run with it on and one with it off.
How do I know a Xalgorix scan actually reached the model?
Don't trust the exit code or "No vulnerabilities found." Run a preflight call first and fail the run if the output contains LLM error. A scan that got model replies also ends with an LLM usage this scan line; our failed scans had none.
Sources
- xalgorix/xalgorix on GitHub: README,
docker-compose.yml,internal/config/config.go,internal/llm/client.go,internal/llm/resolver.go,internal/web/settings_env.go(releasev4.6.213, commit7108346b) - Xalgorix docs: configuration, LLM providers, CLI reference
- Xalgorix PR #942: always-on core system prompt
- Help Net Security: Xalgorix, open-source AI penetration testing tool (November 23, 2026)
- RedRouter compatibility docs
- RedRouter tool calling
- RedRouter models and prices
- RedRouter prompt caching
- RedRouter data handling