A terminal agent that stops to lecture you about the exploit you are reviewing on an authorized target is useless mid-engagement. OpenCode gets around that with one custom provider in opencode.json: the OpenAI-compatible package, this API’s base URL, a key and the model ids. From then on a security-tuned or abliterated build runs in your terminal with tool calls for file edits and shell commands. The same ids also work in Cursor and, via a router, in Claude Code.
What you need
OpenCode installed, a key from the console, and a shell you can export a variable in. Nothing else. If you want to see a security build answer before touching a config file, the home page gives a few free turns in its prompt box and the playground runs the same catalog without an install.
OpenCode loads two config files: opencode.json (or opencode.jsonc, which allows comments) at the project root, and ~/.config/opencode/opencode.json for everything. When both define a key, the project copy takes precedence. OPENCODE_CONFIG redirects it to any other path. Inside the TUI, /connect saves a provider key (a custom provider goes under Other) and /models lists what your config declares so you can switch.
Shortest path to a first reply
- Export the key in the shell you will launch OpenCode from:
export PENTESTLLM_API_KEY="sk-ptl-live-…"- Put the provider block in the project’s
opencode.json, or in the global file if every project should have it. The four ids undermodelsare the ones OpenCode users on this API request most. Add any other id from the models page the same way; thenamevalues come from the catalog:
{ "$schema": "https://opencode.ai/config.json", "provider": { "pentestllm": { "npm": "@ai-sdk/openai-compatible", "name": "PentestLLM", "options": { "baseURL": "https://api.pentestllm.ai/v1", "apiKey": "{env:PENTESTLLM_API_KEY}" }, "models": { "glm-5.3-uncensored": { "name": "GLM-5.3 Uncensored" }, "glm-5.3-flash-uncensored": { "name": "GLM-5.3 Flash Uncensored" }, "deepseek-v4.1-flash-abliterated": { "name": "DeepSeek V4.1 Flash Abliterated" }, "deepseek-v4-pro-uncensored": { "name": "DeepSeek V4 Pro Uncensored" } } } }, "model": "pentestllm/glm-5.3-uncensored"}- Launch
opencodeinside the project. Themodelline has already chosenglm-5.3-uncensored; type/modelsto pick a different id under PentestLLM for this session.
Would rather not leave the key in your environment? Run /connect, pick Other, type pentestllm when asked for the provider id, then paste the key. OpenCode writes it to ~/.local/share/opencode/auth.json. Keep the block above but delete the apiKey line; the id you give /connect must equal the key under provider in the config. The OpenCode agent page shows the newer providers block format and an alias for the auto/security router if you are on a recent OpenCode.
Each line of the block
- npm
- @ai-sdk/openai-compatiblethe SDK package OpenCode loads; it speaks /v1/chat/completions, the route this API serves
- name
- PentestLLMthe label /models shows for the provider
- options.baseURL
- https://api.pentestllm.ai/v1the destination for requests; keep the trailing /v1
- options.apiKey
- {env:PENTESTLLM_API_KEY}the full sk-ptl- key, pulled from the variable at launch; if it is unset you get an empty string, not an error
- models
- id → { name }what the picker lists: each id spelled as on the models page, with its display name
- model
- pentestllm/glm-5.3-uncensoredthe build sessions open with, written provider id / model id; small_model, used for titles, takes the same form
Which build to start with
Through that package OpenCode sends OpenAI-format requests, which every build in the catalog accepts. Cost is set by the shape of an agent turn: the conversation, each file OpenCode has opened and each tool result go back out on every turn, and a short edit comes in. So the input price is nearly the whole bill, and the build with the lowest input price costs least per turn. Tool-call support, which the agent loop needs for edits and shell commands, is in the right-hand column.
| Build | Cost of one agent turn | Tool calls |
|---|---|---|
| GLM-5.3 Uncensored | $0.01 | model page |
| GLM-5.3 Flash Uncensored | $0.0047 | model page |
| DeepSeek V4.1 Flash Abliterated | $0.04 | model page |
| DeepSeek V4 Pro Uncensored | $0.04 | model page |
| GLM-5.3 Abliterated | $0.09 | model page |
| GLM-5.3 Flash Code Uncensored | $0.25 | model page |
| GLM-5.3 Uncensored | Uncensored | $0.282 | $0.846 |
| GLM-5.3 Flash Uncensored | Uncensored | $0.1053 | $0.3685 |
| DeepSeek V4.1 Flash Abliterated | Abliterated | $0.8488 | $1.6975 |
| DeepSeek V4 Pro Uncensored | Uncensored | $0.97 | $1.94 |
| GLM-5.3 Abliterated | Abliterated | $2.1825 | $4.365 |
| GLM-5.3 Flash Code Uncensored | Uncensored | $6.00 | $6.00 |
Spending the day reviewing a client codebase for injection and auth flaws? The coding guide compares the code builds and prices a full day on each. The coding AI page covers why stock assistants refuse that kind of review.
Confirm it works
Ask the API which models the key may call. Each id you declared under models should come back:
curl https://api.pentestllm.ai/v1/models -H "Authorization: Bearer sk-ptl-live-…"Then fire one request shaped like OpenCode’s. The -i flag shows the response headers, which carry a request id and, on a non-streamed reply, the charge in USD.
curl -i https://api.pentestllm.ai/v1/chat/completions \ -H "Authorization: Bearer sk-ptl-live-…" \ -H "Content-Type: application/json" \ -d '{"model": "glm-5.3-uncensored", "messages": [{"role": "user", "content": "Reply with the single word ok."}]}'Inside OpenCode, select one of your ids and give it an in-scope job, for example “read scope.md and list every host the engagement letter excludes”. The request appears on the console’s usage page with its token counts and charge, and its user agent identifies the OpenCode version.
When something fails
401 invalid_api_key: bad or revoked key, orPENTESTLLM_API_KEYwas never exported in the shell that launched OpenCode, soapiKeyresolved to nothing. Export it and relaunch, or copy a fresh key from the console.404 model_not_found: an id in yourmodelsmap does not exist in the catalog. Compare the spelling; the id is the map key, not thenamevalue.402 insufficient_balance: the balance cannot cover this call; add credit in the console. A402 monthly_limit_reachedinstead means the key reached the monthly spend ceiling you gave it.403 scope_denied: this key is restricted to a model list and the requested id is outside it.429 rate_limited: the key is over its rate limit. Readretry-afteron the response.- Requests that never arrive, or land on a path other than
/chat/completions: wrong package. OpenCode’s docs put@ai-sdk/openai-compatibleon endpoints that serve/v1/chat/completions, which this one does, and@ai-sdk/openaion endpoints that serve/v1/responses. Leavenpmon the first. - After
/connectthe provider is not in/models: the id you typed in/connectdoes not match the key underprovider. Make them identical.
Questions
Yes, with OpenAI itself and with every endpoint speaking the OpenAI chat completions format. OpenCode reaches it through the @ai-sdk/openai-compatible package plus a baseURL and a key. This API is such an endpoint, so the block on this page is the entire setup.
A built-in list that /connect shows by name, plus a custom entry for any other OpenAI-compatible API, declared under provider in opencode.json: package, base URL, model ids. This page walks the custom route.
All of them. Each id on the models page serves /v1/chat/completions in OpenAI format under one shared key, so any id can go into the provider block’s models map, spelled as the page spells it. See the models page.
You pay per token at the model’s listed price out of prepaid credit, with no subscription required. The table above prices a typical agent turn per build at the current rate. When a long session repeats the same prefix, the cached input tokens are charged at that model’s discounted cache price.
Every model above is on the uncensored model list with its live price per million tokens. Per-token pricing sets the whole catalog side by side, and the family directory groups the builds by base model.