One URL change. Every AI conversation guard-railed, logged and evaluated.
Point the SDK you already use at Sparring. Model tokens are metered at the provider's list price × 1.05 — zero on your own keys. Every request is checked inline before and after the model, every response is logged without bodies, sampled conversations are scored with cited evidence, and incidents become regression tests automatically. If we are ever unreachable, your application falls back to the provider: fail-open by design.
Connect in one line
Keep your code, your models and your prompts. Change the base URL.
// Before // After — one line
import Anthropic from "@anthropic-ai/sdk"; import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({ const client = new Anthropic({
apiKey: proces...KEY baseURL: "https://app.sparringhq.com/api/v1/models/anthropic",
}); apiKey: proces...KEY // your Sparring key
});import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://app.sparringhq.com/api/v1/models/openai/v1", apiKey: proces...KEY });
const r = await client.chat.completions.create({ model: "gpt-6-astra", messages });
// r.headers: X-Sparring-Guardrail: pass · X-Sparring-Upstream: managed · X-Sparring-CU: 0.1 · X-Sparring-Credits: 0.0041What the gateway does
Four things happen to every request. None of them changes what your model says — unless you ask for block mode.
Guardrails, inline
Deterministic checks on the request and the response — PII (cards, national IDs, API keys), crisis language, and your own tripwire rules — in under 5 ms, no model call. Flag mode reports the verdict in a header; block mode stops a critical request with a 422 or replaces a critical response with a safe refusal.
Routing with fail-over
By default your traffic runs on Vertex AI inside Sparring's Google Cloud project (Gemini and Claude). You can switch an organisation to Sparring's managed channel or your own key, and you can disable non-Google fail-over entirely for data residency. A channel that errors is cooled down for 60 seconds and skipped. X-Sparring-Failover tells you when it happened.
Evaluation, asynchronous
A sample of conversations — and every flagged one — is scored after the response is sent by the same evidence judge that powers Arena: outcome, skills, strengths and weaknesses that quote the exact words. Findings land in GET /v1/findings and in your console.
Incidents become tests
A critical finding on production traffic is turned into a draft Arena scenario in your library. Approve it, and every release runs against the failure that actually happened. The longer you run, the larger your regression suite.
Never your single point of failure.
If the gateway is unreachable or /v1/health reports down, your SDK falls back to the provider directly. You lose guardrails and logging for that window — never your service. Sparring is designed not to be a single point of failure.
GET /v1/health needs no key and is not billed. It reports gateway liveness, database state and per-channel health, so your client can decide in one call.
// Fail-open: Sparring must never be your single point of failure.
const health = await fetch("https://app.sparringhq.com/api/v1/health").then(r => r.ok).catch(() => false);
const client = new Anthropic(health
? { baseURL: "https://app.sparringhq.com/api/v1/models/anthropic", apiKey: SPARRING_KEY }
: { apiKey: ANTHROPIC_KEY }); // direct to the provider: no guardrails for this window, no outageEvery response tells you what happened.
| X-Sparring-Guardrail | pass · flag:<rules> · block:<rules> — the inline verdict for this request |
| X-Sparring-Upstream | vertex · byok · managed · official — which channel served it |
| X-Sparring-Failover | Present when a channel was skipped; lists attempts |
| X-Sparring-Credits | Model tokens metered at list price × 1.05 (0 for BYOK) |
| X-Sparring-CU | Conversation Units billed for this request |
| X-Request-Id | Quote it to support |
HTTP/1.1 422 Unprocessable Entity
X-Sparring-Guardrail: block:pii.card_number
{ "error": { "type": "guardrail_blocked",
"message": "Request blocked by your organisation's Sparring guardrail policy",
"rules": ["pii.card_number"], "request_id": "req_…" } }Streams are never cut mid-flight (that would corrupt your parser); a critical hit on a streamed response is flagged and evaluated, not blocked.
Three channels to a model
Google Cloud native by default; the other two are opt-in. Assurance work is metered the same way on all three.
| Channel | What it means | Availability |
|---|---|---|
| Vertex AI — Google Cloud native (default) | Gemini 4 served from Vertex AI inside Sparring's Google Cloud project, metered at Google's list price × 1.05. Requests never leave Google Cloud. | All plans |
| Sparring managed channel | Claude and GPT families via Sparring's provider channel, metered at the provider's list price × 1.05; also the fail-over when Vertex is unavailable (can be disabled). | All plans |
| Bring your own key | Your Anthropic / OpenAI account; key encrypted at rest, never logged. Tokens not metered; CU only. | Team and above |
- Per-organisation model allow-list
- Monthly budget in credits with hard stop and 80% alert
- Per-key requests-per-minute
- Guardrail policy: off · flag · block; PII, crisis, custom tripwires
- Evaluation policy: sample rate; flagged exchanges always evaluated
- Region policy: gcp-resident tenants pinned to Vertex AI
- Request log without bodies by default; bodies only with explicit opt-in
- Idempotency keys; X-Request-Id on every response
| none | Raw passthrough — your prompt, our routing and governance |
| coach | Sparring's coach preset prepended: structured, evidence-citing feedback style |
| judge | Sparring's judge preset: outcome/performance separation, quoted evidence, SCS skills |
What it costs
Tokens pass through at list. You pay for assurance work in Conversation Units — defined by the work, not by the model behind it.
| Work | CU | At list |
|---|---|---|
| Gateway request (inline guardrail, both sides) | 0.1 CU | $0.01 |
| Conversation evaluated (evidence judge) | 20 CU | $2.00 |
| Simulated counterpart turn | 5 CU | $0.50 |
| Arena session (red-team run of your agent) | 125 CU | $12.50 |
| Practice session (human, with debrief) | 200 CU | $20.00 |
The capability API
The same engine, callable directly when you have your own harness.
POST /v1/evaluate
Send any transcript — a support chat, a sales call, an agent log. Outcome, 0–3 skill ratings on the SCS, strengths and weaknesses that quote the exact words, rewrites. A verifier removes any claim it cannot find.
POST /v1/simulate
A counterpart with a stance, a hidden motive and pressure tactics for your own test harness — stateless, streamed. Plug it into Promptfoo, DeepEval or a plain script.
POST /v1/guardrail
The gateway's tripwire engine as a batch endpoint — up to 500 texts a call, negation-aware, severity and matched span.
| Endpoint | Unit | Rate |
|---|---|---|
| POST /v1/models/* | per request · Guardrails on; tokens 0 for BYOK | 0.1 CU + tokens at list × 1.05 |
| POST /v1/evaluate | per transcript evaluated · Up to 8k input tokens; +10 CU per additional 8k | 20 CU |
| POST /v1/simulate | per counterpart turn · ≈ 50–75 CU per full conversation | 5 CU |
| POST /v1/guardrail | per 100 checks · Deterministic; negation-aware | 10 CU |
| POST /v1/sessions … | per session · Same as the app | 200 CU practice · 125 CU arena |
Bodies are not stored. Verdicts are.
Gateway requests are logged as metadata: request id, model, channel, token counts, latency, guardrail verdict. Prompt and completion bodies are forwarded and discarded. Evaluation stores the judge's findings with quoted evidence; the transcript excerpt is kept only if you turn on keep_bodies. BYOK keys are AES-256-GCM encrypted and never logged.
Governed means governed.
- ●Reselling access to third parties or operating a public API storefront on top of Sparring
- ●Prompting for content that targets real individuals (social engineering, harassment)
- ●Employment, credit, insurance or legal decisions about individuals
- ●Training or distilling models from outputs
- ●Anything the upstream model provider's usage policy prohibits — it applies in full
Questions engineers ask
What does the gateway add to latency?+
What happens if Sparring is down?+
Is block mode safe for production?+
Do you store our prompts and transcripts?+
Which models are behind the gateway?+
Rate limits?+
Start on Google Cloud Marketplace.
Sign in, open Settings → Developer, copy the base URL, change one line. Tokens at list, guardrails from the first request.