> ## Documentation Index
> Fetch the complete documentation index at: https://docs.promptguard.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Upgrade to SDK and CLI 2.0

> What the Python SDK, Node.js SDK and CLI 2.0.0 removed, what to use instead, and how to find the calls in your code.

The Python SDK, the Node.js SDK and the CLI each released **2.0.0 on
2026-08-26**. The major version is for removals only: every call that 2.0.0
removed sent its request to an endpoint the API does not serve, so it had
never returned a result. Nothing that worked was taken away, and nothing was
renamed.

If your code never used the calls below, upgrade with no changes. Version
1.x of each SDK gets security fixes until 2027-08-26, 12 months after 2.0.0
shipped, as [Versioning & support](https://docs.promptguard.co/versioning-and-support.md#sdks) promises.

## Find what you need to change

Run this from the root of your project. No output means nothing to change.

```bash Python theme={"system"}
grep -rnE '\.(completions\.create|embeddings\.create|scrape\.(url|batch)|redteam\.(run_autonomous|intelligence_stats))\(' --include='*.py' . | grep -v 'chat\.completions'
```

```bash Node.js theme={"system"}
grep -rnE '\.(completions\.create|embeddings\.create|scrape\.(url|batch)|redteam\.(runAutonomous|intelligenceStats))\(|AutonomousRedTeam(Report|Request)|\bCompletion(Request|Response)|\bEmbedding(Request|Response)|IntelligenceStats|ScrapeResult' --include='*.ts' --include='*.js' --exclude-dir=node_modules . | grep -v 'chat\.completions'
```

```bash CLI theme={"system"}
grep -rnE 'promptguard (logs|events)\b|promptguard redteam .*--(autonomous|budget)' .
```

## Python SDK

Removed from both `PromptGuard` and `PromptGuardAsync`:

| Removed in 2.0.0 | What to use instead |
| - | - |
| `client.completions.create(...)` | `client.chat.completions.create(...)`, which is unchanged |
| `client.embeddings.create(...)` | Nothing. Delete the call, or call your model provider's embeddings API directly |
| `client.scrape.url(...)`, `client.scrape.batch(...)` | Nothing. Delete the call |
| `client.redteam.run_autonomous(...)` | Nothing equivalent. `client.redteam.run_all(...)` runs the fixed attack corpus against a preset |
| `client.redteam.intelligence_stats()` | Nothing. Delete the call |

**Text completions.** Send the prompt as one user message:

```python Before (1.x) theme={"system"}
from promptguard import PromptGuard

pg = PromptGuard(api_key="pg_live_xxx")
response = pg.completions.create(model="gpt-5-nano", prompt="Summarise this ticket")
```

```python After (2.0) theme={"system"}
from promptguard import PromptGuard

pg = PromptGuard(api_key="pg_live_xxx")
response = pg.chat.completions.create(
    model="gpt-5-nano",
    messages=[{"role": "user", "content": "Summarise this ticket"}],
)
```

**Embeddings, scraping and intelligence stats.** Delete the calls. Each one
raised an error on every call in 1.x, so no working code depends on what they
returned:

```python Before (1.x) theme={"system"}
vectors = pg.embeddings.create(model="text-embedding-3-small", input="hello")
page = pg.scrape.url("https://example.com")
stats = pg.redteam.intelligence_stats()
```

```python After (2.0) theme={"system"}
# Removed: these calls never returned a result.
```

**Autonomous red team.** It is not offered to API keys. To test your policy
against PromptGuard's attack corpus, run the whole corpus against a preset:

```python Before (1.x) theme={"system"}
report = pg.redteam.run_autonomous(budget=200, target_preset="support_bot:strict")
```

```python After (2.0) theme={"system"}
summary = pg.redteam.run_all(target_preset="support_bot:strict")
print(f"Blocked {summary['blocked']}/{summary['total_tests']}")
```

## Node.js SDK

| Removed in 2.0.0 | What to use instead |
| - | - |
| `pg.completions.create(...)` | `pg.chat.completions.create(...)`, which is unchanged |
| `pg.embeddings.create(...)` | Nothing. Delete the call, or call your model provider's embeddings API directly |
| `pg.scrape.url(...)`, `pg.scrape.batch(...)` | Nothing. Delete the call |
| `pg.redteam.runAutonomous(...)` | Nothing equivalent. `pg.redteam.runAll(...)` runs the fixed attack corpus against a preset |
| `pg.redteam.intelligenceStats()` | Nothing. Delete the call |
| The exported types `AutonomousRedTeamReport`, `AutonomousRedTeamRequest`, `CompletionRequest`, `CompletionResponse`, `EmbeddingRequest`, `EmbeddingResponse`, `IntelligenceStats` and `ScrapeResult` | Delete the import. For chat, `ChatCompletionRequest` and `ChatCompletionResponse` are unchanged |

The removed types are why TypeScript code that only imported them fails to
compile on 2.0.0, even though it never called anything.

**Text completions.** Send the prompt as one user message:

```typescript Before (1.x) theme={"system"}
import { PromptGuard, type CompletionResponse } from 'promptguard-sdk';

const pg = new PromptGuard({ apiKey: process.env.PROMPTGUARD_API_KEY! });
const response: CompletionResponse = await pg.completions.create({
  model: 'gpt-5-nano',
  prompt: 'Summarise this ticket',
});
```

```typescript After (2.0) theme={"system"}
import { PromptGuard, type ChatCompletionResponse } from 'promptguard-sdk';

const pg = new PromptGuard({ apiKey: process.env.PROMPTGUARD_API_KEY! });
const response: ChatCompletionResponse = await pg.chat.completions.create({
  model: 'gpt-5-nano',
  messages: [{ role: 'user', content: 'Summarise this ticket' }],
});
```

**Autonomous red team.** Run the whole corpus against a preset instead:

```typescript Before (1.x) theme={"system"}
const report = await pg.redteam.runAutonomous({ budget: 200, targetPreset: 'support_bot:strict' });
```

```typescript After (2.0) theme={"system"}
const summary = await pg.redteam.runAll('support_bot:strict');
console.log(`Blocked ${summary.blocked}/${summary.totalTests}`);
```

`pg.embeddings`, `pg.scrape` and `pg.redteam.intelligenceStats()`: delete the
calls and their type imports.

## CLI

| Removed in 2.0.0 | What to use instead |
| - | - |
| `promptguard logs` | The **Activity** page in the dashboard. `promptguard dashboard` opens it in your browser |
| `promptguard events` | The same |
| `promptguard redteam --autonomous` and `--budget` | `promptguard redteam`, which runs the attack corpus against a preset |
| The intelligence-stats output | Nothing |

A script that still calls a removed command now exits with an
unrecognised-subcommand error instead of a request failure, so a CI step that
ignored the old failure will start failing.

```bash Before (1.x) theme={"system"}
promptguard logs --limit 50
promptguard redteam --autonomous --budget 50 --preset strict
```

```bash After (2.0) theme={"system"}
promptguard dashboard
promptguard redteam --preset strict
```

## What also changed, with nothing to do

The red team calls that 2.0.0 kept (`run_test`, `run_all` and `run_custom` in
Python, `runTest`, `runAll` and `runCustom` in Node.js, and `promptguard
redteam`) got an authorization error for every API key in 1.x, because
they called an admin-only path.
From 2.0.0 they work with an API key that has the `proxy` scope. Their names
and arguments did not change.

## Shadow AI desktop agent 0.10

The desktop agent is versioned on its own and has no 2.0. Its one breaking
change so far is in 0.10.0: protection runs only while the PromptGuard Shadow
app is running. If an RMM tool or login script starts the agent with
`pgshadow start` and no app, set the managed key
[`headless: true`](https://docs.promptguard.co/shadow-ai/fleet-enrollment#managed-configuration-mdm)
before you upgrade, or protection on those machines stops. What to do for
each later agent Release is on
[Shadow AI desktop agent upgrade notes](https://docs.promptguard.co/releases/desktop-agent.md).

## Next steps

> [card] [Versioning & support](https://docs.promptguard.co/versioning-and-support.md#sdks)
>
> How long each SDK and CLI version gets fixes

> [card] [Changelog](https://docs.promptguard.co/changelog.md)
>
> What changed in each Release, filterable by product

> [card] [Python SDK](https://docs.promptguard.co/guides/python-sdk.md)
>
> Use the 2.x Python SDK

> [card] [Node.js SDK](https://docs.promptguard.co/guides/node-sdk.md)
>
> Use the 2.x Node.js SDK


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.