---
title: "PentestLLM API docs: base URL, key, model id, server tools"
canonical: https://pentestllm.ai/docs
generated: 2026-11-11T18:02:47.139Z
source: https://pentestllm.ai/docs
base_url: https://api.pentestllm.ai/v1
---

## OpenAI SDK, Python

main.py

```
from openai import OpenAI

client = OpenAI(base_url="https://api.pentestllm.ai/v1", api_key="sk-ptl-live-…")
reply = client.chat.completions.create(
    model="cyber-frontier",
    messages=[{"role": "user", "content": "Hello"}],
    stream=True,
)
for chunk in reply:
    print(chunk.choices[0].delta.content or "", end="")
```

## OpenAI SDK, Node

main.mjs

```
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.pentestllm.ai/v1", apiKey: "sk-ptl-live-…" });
const stream = await client.chat.completions.create({
  model: "cyber-frontier",
  messages: [{ role: "user", content: "Hello" }],
  stream: true,
});
for await (const chunk of stream) process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
```

## Anthropic SDK and Claude Code

The listed models answer the Messages API at the same host, so Claude Code and anything built on the Anthropic SDK can run one with `ANTHROPIC_BASE_URL` set to `https://api.pentestllm.ai` and your key.

anthropic.py

```
import anthropic

client = anthropic.Anthropic(base_url="https://api.pentestllm.ai", api_key="sk-ptl-live-…")
msg = client.messages.create(model="cyber-frontier", max_tokens=1024, messages=[{"role": "user", "content": "Hello"}])
print(msg.content[0].text)
```

## Coding agents

In OpenCode, Cline, Cursor or any agent with an OpenAI-compatible provider: add a provider with base URL `https://api.pentestllm.ai/v1` and your key, then name the model id. Each model page lists the context window to enter. Setup per agent is under [agents](https://pentestllm.ai/agents).

## The security router

Send `auto/security` as the model and the gateway picks a security build per request from fast, balanced and frontier tiers, billed at that model’s own price. An `x-session-id` header keeps one model for a run, and `"auto": {"tier_max": "balanced"}` caps the tier. The [router page](https://pentestllm.ai/auto-router) lists each tier’s models and prices.

## Server tools

A request can declare tools that run on our side inside the same request, on a model that takes tools (18 of the 42 listed models today). Fees are read from the live catalog:

server tools, fee per use

- Web search: $0.01 per search `{"type": "web_search"}`
- Web fetch: $0.001 per page fetched `{"type": "web_fetch"}`
- Code sandbox: $0.05 per container-hour, 1-minute minimum `{"type": "code_interpreter"}`
- Remote MCP: No tool fee `{"type": "mcp", "server_url": …}`

curl

```
curl https://api.pentestllm.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-ptl-live-…" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "cyber-frontier",
    "tools": [{"type": "web_search"}],
    "messages": [{"role": "user", "content": "Summarize the vendor advisory for CVE-2024-3094 and list the fixed versions."}]
  }'
```

The code sandbox runs code the model writes in a container on our side, not on your machine. It is for analysis: parsing scan output, decoding a sample, testing a detection rule. Point tools only at systems and data you are authorized to work with.

## Headers on every answer

`x-uplink-request-id` identifies the request for support, `x-uplink-charge` carries the settled charge on a non-streamed answer, and a streamed answer ends with its usage block. A request that fails before the model answers is not charged.

## Machine-readable

The OpenAPI document is at `https://api.pentestllm.ai/openapi.json` and the model catalog at `https://api.pentestllm.ai/v1/catalog`, with no key. This site publishes the same list as [pricing-index.json](https://pentestllm.ai/pricing-index.json), a text index at [llms.txt](https://pentestllm.ai/llms.txt), and a markdown copy of each main page at its path plus `.md`.
