# SQLGuard SDK

**Library:** `sqlguard-client` · **CDN:** `/sdk/sqlguard-client.js` · **Card:** `/sdk`

Zero-dependency agent client. Handshake → route SKU → certify/bind/session → verify/GATE. Built-in upsells when payment or authorize is still required.

## Install

```bash
npm i sqlguard-client
```

```js
import { SqlGuard } from "https://sqlguard.io/sdk/sqlguard-client.js";
```

## Upsell ladder (smart, not spam)

1. **Handshake** — ask what you need; default Instant Cert `$0.05`
2. **Free probe** — if high risk → Instant Cert (tip never authorizes)
3. **Mandate / Intent** → Mandate Bind `$0.07` then free GATE
4. **Burst (≥3 one-shots)** → Session `$0.20`
5. **Volume language** → micro `$0.10`
6. **402** → settle Exact USDC on Base, retry with x402 fetch

## Example

```js
import { SqlGuard } from "sqlguard-client";

const sg = new SqlGuard({ agentId: process.env.AGENT_ID });
const out = await sg.authorize({
  need: "authorize one INSERT",
  schema_ddl: "CREATE TABLE t(id int);",
  sql: "INSERT INTO t VALUES (1);",
  probeFirst: true,
});
if (!out.ready) console.log(out.upsell); // settle / buy
```

MCP: `sqlguard_sdk` · Legal: `/legal` · Money: `/v1/money`
