OpenCode on a security model that answers

Wire OpenCode to this API with a single provider entry in opencode.json naming the openai-compatible package, the base URL, an environment variable for the key and the ids /models should list. Then what an agent turn costs and how to read each error.

Steps checked November 2, 2026 · prices as of November 18, 2026

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

  1. Export the key in the shell you will launch OpenCode from:
shell
1export PENTESTLLM_API_KEY="sk-ptl-live-…"
  1. Put the provider block in the project’s opencode.json, or in the global file if every project should have it. The four ids under models are the ones OpenCode users on this API request most. Add any other id from the models page the same way; the name values come from the catalog:
opencode.json
1{
2 "$schema": "https://opencode.ai/config.json",
3 "provider": {
4 "pentestllm": {
5 "npm": "@ai-sdk/openai-compatible",
6 "name": "PentestLLM",
7 "options": {
8 "baseURL": "https://api.pentestllm.ai/v1",
9 "apiKey": "{env:PENTESTLLM_API_KEY}"
10 },
11 "models": {
12 "glm-5.3-uncensored": { "name": "GLM-5.3 Uncensored" },
13 "glm-5.3-flash-uncensored": { "name": "GLM-5.3 Flash Uncensored" },
14 "deepseek-v4.1-flash-abliterated": { "name": "DeepSeek V4.1 Flash Abliterated" },
15 "deepseek-v4-pro-uncensored": { "name": "DeepSeek V4 Pro Uncensored" }
16 }
17 }
18 },
19 "model": "pentestllm/glm-5.3-uncensored"
20}
  1. Launch opencode inside the project. The model line has already chosen glm-5.3-uncensored; type /models to 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-compatible
the SDK package OpenCode loads; it speaks /v1/chat/completions, the route this API serves
name
PentestLLM
the label /models shows for the provider
options.baseURL
https://api.pentestllm.ai/v1
the 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-uncensored
the 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.

BuildCost of one agent turnTool calls
GLM-5.3 Uncensored$0.01model page
GLM-5.3 Flash Uncensored$0.0047model page
DeepSeek V4.1 Flash Abliterated$0.04model page
DeepSeek V4 Pro Uncensored$0.04model page
GLM-5.3 Abliterated$0.09model page
GLM-5.3 Flash Code Uncensored$0.25model page

A turn here is 40,000 tokens in and 1,200 out, priced from the catalog as of 2026-11-18. Tool-call support is whatever the catalog states; when it states nothing, the model page has the answer.

Uncensored models and their prices per million tokens
GLM-5.3 Uncensoredglm-5.3-uncensoredUncensored$0.282$0.846
GLM-5.3 Flash Uncensoredglm-5.3-flash-uncensoredUncensored$0.1053$0.3685
DeepSeek V4.1 Flash Abliterateddeepseek-v4.1-flash-abliteratedAbliterated$0.8488$1.6975
DeepSeek V4 Pro Uncensoreddeepseek-v4-pro-uncensoredUncensored$0.97$1.94
GLM-5.3 Abliteratedglm-5.3-abliteratedAbliterated$2.1825$4.365
GLM-5.3 Flash Code Uncensoredglm-5.3-flash-code-uncensoredUncensored$6.00$6.00

Prices per million tokens, read from the live catalog on 2026-11-18.

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:

shell
1curl 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.

shell
1curl -i https://api.pentestllm.ai/v1/chat/completions \
2 -H "Authorization: Bearer sk-ptl-live-…" \
3 -H "Content-Type: application/json" \
4 -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, or PENTESTLLM_API_KEY was never exported in the shell that launched OpenCode, so apiKey resolved to nothing. Export it and relaunch, or copy a fresh key from the console.
  • 404 model_not_found: an id in your models map does not exist in the catalog. Compare the spelling; the id is the map key, not the name value.
  • 402 insufficient_balance: the balance cannot cover this call; add credit in the console. A 402 monthly_limit_reached instead 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. Read retry-after on the response.
  • Requests that never arrive, or land on a path other than /chat/completions: wrong package. OpenCode’s docs put @ai-sdk/openai-compatible on endpoints that serve /v1/chat/completions, which this one does, and @ai-sdk/openai on endpoints that serve /v1/responses. Leave npm on the first.
  • After /connect the provider is not in /models: the id you typed in /connect does not match the key under provider. 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.

Get a keyPrepaid from $10, no subscription.

New models and price changes, once a month.

New uncensored builds with their prices, price moves, and what the daily model check found.

Help