#560
feat: add AnonRouter provider
Summary
- Adds AnonRouter to the maintained
pentestgpt_legacyprovider layer using its existing OpenAI-compatible client. - Adds the dynamic model form
anonrouter:<provider>/<model>and passes the nested model ID unchanged tohttps://api.anonrouter.ai/v1. - Reads a dedicated
ANONROUTER_API_KEY, with optionalANONROUTER_BASE_URLoverride, and keeps provider credentials isolated. - Adds CLI/configuration guidance and focused registry, configuration, and factory tests.
Why
I maintain AnonRouter and implemented this through PentestGPT's existing dynamic-provider pattern. A static model list would quickly drift, so the prefix accepts any exact model ID enabled for the user's AnonRouter account. This also avoids adding a dependency or duplicating the OpenAI-compatible transport.
The change is scoped to pentestgpt_legacy, whose native LLM layer supports HTTP providers. pentestgpt_agent is intentionally untouched because its provider boundary is the external unified-agent Claude/Codex CLI adapter.
Usage
export ANONROUTER_API_KEY='<key>'
pentestgpt-legacy \
--reasoning-model anonrouter:<provider>/<model> \
--parsing-model anonrouter:<provider>/<model>Checks
- Root tests excluding Docker — 141 passed
- Legacy focused suite — 33 passed
- Ruff check and format — passed
- Strict mypy for the touched runtime — passed
uv lock --check— passed- Root and nested-agent package builds — passed
- Nested-agent suite — 118 passed, 1 skipped
- Live smoke through PentestGPT's actual
get_client/AsyncOpenAIpath — successful authenticated completion withopenai/gpt-4o-mini