Scan your whole stack
From OX Research Newsroom
Are you using provider-guard?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.1.0
provider-guard was last scanned on 29 Sep 2026 at version 0.1.0. Risk score 40 of 100 (medium). High-severity rules fired.
| Version | Published | Status |
|---|---|---|
| 0.1.0 LATEST | 29 Sep 2026 | 2 rules fired |
Findings for v0.1.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The same file reads a registry, cloud or CI secret from the environment and starts a detached process that keeps running after the parent exits. The scanner does not check that the secret is passed to that process. A background process that outlives the package does not normally need the package's credentials.
HIGHThe score describes 0.1.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
The gateway catches errors. provider-guard catches successes that aren't.
· Live demo, a replay of the data published in the issues below
AI SDK middleware for apps on Vercel AI Gateway. It catches responses that return HTTP 200 and bill tokens but deliver nothing, retries them once on a different provider, lets you exclude one provider for one model, and records what happened without ever storing prompts or responses.
AI Gateway routes one model ID to many providers and falls back only when a call fails. When a provider returns a successful but unusable response, nothing fails, so nothing falls back: in vercel/ai#20932, Baseten billed the final answer of zai/glm-5.3-flash but streamed no text in 22 of 51 reasoned calls with tools. You also cannot exclude one provider per request today, because exclude compiles but is silently ignored (vercel/ai#20934), and a provider can silently drop reasoning effort (vercel/ai#21207).
npm install provider-guard
Requires ai@7 and Node.js 22 or later. provider-guard has no runtime dependencies.
import { gateway } from '@ai-sdk/gateway'
import { streamText, wrapLanguageModel } from 'ai'
import { exclude, guard } from 'provider-guard'
const model = wrapLanguageModel({ model: gateway('zai/glm-5.3-flash'), middleware: guard() })
const result = streamText({
model,
tools,
prompt,
providerOptions: { gateway: await exclude('zai/glm-5.3-flash', ['baseten']) },
})
The built-in billedButEmpty detector catches an attempt when all four are true:
stop.usage.outputTokens.text > 0, or total − reasoning > 0 when the provider does not report text tokens separately. If neither can be computed, nothing is caught.treatWhitespaceAsEmpty: false to count it.You can add your own detectors. A detector receives a content-free summary of the call and returns { id, reason, retry } or null:
import { guard, type Detector } from 'provider-guard'
const tooShort: Detector = (call) =>
call.finishReason === 'length' && call.delivered.textChars < 20
? { id: 'too-short', reason: 'Hit the length limit almost immediately', retry: false }
: null
guard({ detectors: ['billedButEmpty', tooShort] })
still-empty and returned as is.failed.finish part of a caught stream is held back; detectors run on it synchronously.fallbacksAvailable (or, if absent, the model's current provider list) minus the provider that served the empty answer, intersected with your only. That provider is also removed from your order. sort, models, and every other option are unchanged.usage is their sum. providerMetadata.providerGuard lists each attempt's provider and usage.streamText, the retry is spliced into the same stream. Its reasoning is dropped by default because the first attempt's reasoning was already streamed; pass retry: { reasoning: 'keep' } to forward it. Exactly one finish part is emitted.import { guard } from 'provider-guard'
import { fileSink } from 'provider-guard/node'
guard({
detectors: ['billedButEmpty'], // default
retry: { max: 1, reasoning: 'drop' }, // default; max: 0 detects and records without retrying
treatWhitespaceAsEmpty: true, // default
sink: fileSink('.provider-guard/calls.jsonl'), // default in Node; memory sink elsewhere
onIncident: (incident) => console.warn(incident.record.retry),
})
exclude()Exclude one provider for one model and keep every other provider, including ones added later:
providerOptions: {
gateway: {
sort: 'cost',
...(await exclude('zai/glm-5.3-flash', ['baseten'])),
},
}
exclude() reads the model's providers from the public AI Gateway endpoints API (GET https://ai-gateway.vercel.sh/v1/models/{creator}/{model}/endpoints, no API key) and returns { only: [...] } with every provider except the ones you named. When nothing would actually be excluded, it returns {}.
ttlMs (default 10 minutes). After that, the cached list is returned at once and refreshed in the background. Concurrent calls share one request.exclude() returns {} (every provider stays eligible) and logs a warning, or throws ProviderListUnavailableError with onUnavailable: 'throw'. After a failure it waits 30 seconds before fetching again.NoProvidersLeftError, which names the model and the list.| Option | Default | |
|---|---|---|
ttlMs |
600000 |
How long a list is fresh |
onUnavailable |
'allow-all' |
Or 'throw' |
fetch |
globalThis.fetch |
For tests or proxies |
baseURL |
'https://ai-gateway.vercel.sh' |
providerOptions.gateway.exclude is ignored by AI Gateway as of 2026-09-28. guard() logs a warning once per process when it sees it.
provider-guard report summarizes provider health per model from your recorded calls:
npx provider-guard report
This is the report on the replay data reconstructed from the three issues:
zai/glm-5.3-flash 88 attempts · 22 caught
provider attempts empty reasoned
baseten 51 22 (43.1%) 100% outlier p < 0.0001
zai 30 0 (0.0%) 100%
fireworks 7 0 (0.0%) 100%
zai/glm-4.7 66 attempts · 0 caught
provider attempts empty reasoned
baseten 40 0 (0.0%) 0%
zai 26 0 (0.0%) 77%
openai/gpt-5.6-sol 12 attempts · 0 caught
provider attempts empty reasoned
bedrock 6 0 (0.0%) 100%
openai 6 0 (0.0%) 100%
reasoning tokens (median) low xhigh
bedrock 2,704 3,060 effort appears ignored
openai 1,750 6,711
--file <path> (default .provider-guard/calls.jsonl), --model <id>, --since 15m|1h|7d, and --json for machine-readable output.0 success, 1 usage error, 2 records file not found or unreadable. Colors appear only on a terminal and respect NO_COLOR and FORCE_COLOR.provider-guard studio opens a local dashboard at http://127.0.0.1:4747 (if that port is busy, the next 10 are tried). It reads .provider-guard/calls.jsonl and follows it as new calls are recorded.



The public demo at https://provider-guard-demo.vercel.app plays the published issue data. To replay it locally without any records of your own:
npx provider-guard studio --replay all
Options: --file <path>, --port <n>, --replay all|vercel-ai-20932|vercel-ai-21207, --no-open, and --json.
Each attempt is one JSON line, appended to .provider-guard/calls.jsonl in Node (add .provider-guard/ to your .gitignore). A caught attempt and its retry are linked by retryOf:
{
"v": 1,
"id": "pg_01K6A…",
"retryOf": null,
"ts": "2026-09-28T10:15:02.114Z",
"model": "zai/glm-5.3-flash",
"provider": "baseten",
"mode": "stream",
"finish": "stop",
"tokens": { "in": 1830, "out": 6, "text": 4, "reasoning": 2 },
"delivered": { "textChars": 0, "reasoningChars": 4, "toolCalls": 0 },
"reasoningRequested": null,
"flags": ["billed-but-empty"],
"retry": { "attempted": true, "provider": "zai", "outcome": "recovered", "skipReason": null },
"parts": [{ "t": "reasoning-delta", "ms": 212 }, { "t": "reasoning-delta", "ms": 260 }, { "t": "finish", "ms": 301 }],
"generationId": "gen_…",
"durationMs": 301
}
retry.outcome is recovered, still-empty, failed, or skipped; a skipped retry says why in skipReason (for example no-alternative-provider or tool-call-emitted).
Pass any sink as guard({ sink }): fileSink(path) from provider-guard/node, memorySink(), consoleSink(), noopSink(), or your own { write(record) }. Sink errors are logged once and never reach your app. In Edge runtimes the default is memorySink().
127.0.0.1, serves only the records file and its own assets, and refuses requests for any other host name.exclude() or when a retry needs the model's provider list. Adoption is measured only by npm downloads and GitHub activity.ai@7) for the file sink, CLI, and Studio. The main entry has no Node imports and runs in Edge runtimes with an in-memory sink.excludeAI Gateway ignores a request-level exclude today (vercel/ai#20934). If it ships, exclude() becomes a thin shim over the native option, and provider-guard will adopt it.
MIT. Not affiliated with Vercel.
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.