SmartTokenGuard

io.github.nwjnjjjPublished by GitHub account nwjnjjjv1.2.2Updated Nov 2, 2026

Stop burning credits on broken AI video: check every render before you pay for the next one.

VerifiedStreamable HTTPWeb executableData & AnalyticsMedia & DesignAI & ML

Overview

AI-generated overview

Checks AI-generated keyframes and video clips for technical defects and returns a pass, retry, switch-model or halt verdict before you pay for the next render.

What you can do
  • Inspect images and video for blur, exposure, black frames, frozen segments, flicker, cuts and colour drift against a reference image, with review frames returned.
  • Decide whether a render passes, should be retried on the same model, switched to a fallback, or halted, with concrete fixes such as negative-prompt terms, lower motion or a new seed.
  • Locate exact frames of impacts, flashes and cuts for placing sound effects.
  • Report project spend, attempts per passed shot, first-try pass rate and keyframes rejected before video was paid for.
  • Check license usage and plan pricing.
When to use it
Useful when generating AI video or keyframes in tools such as ComfyUI, Kling, Runway, Veo, Hailuo or Seedance and you want each render screened before spending credits on the next paid step. Best suited to workflows where a rejected still saves money and a rejected clip has already been paid for.
Requirements
A paid Starter or Pro license key from a Polar receipt, supplied as the STG_LICENSE_KEY environment variable for local installs or as an Authorization bearer header for the remote endpoint. Local install requires uv; the remote MCP endpoint needs no install but only accepts public https media URLs. Files are limited to 32 MB, 60 seconds and 1080p, with 30 requests per minute.
Before you install
The license key doubles as the API key and is sent to the API; keep it private. Paid plans are billed monthly or yearly through Polar, and checks reset monthly. Uploaded media goes to a Google Cloud-hosted API, which the README says deletes it before responding. Verdicts cover technical render failures only, not anatomy, identity, copyright or story quality. Spend ledgers stay on the local machine.

Installation

In SourceWeft

  1. Open SmartTokenGuard in the dashboard and add it to a workspace.
  2. Connect Authorization token credentials. They are stored privately and never shown on public pages.
  3. Enable the server for the chats that should use its tools.

Web executable via Streamable HTTP. Remote servers run from the web runtime once configured in a workspace.

Use with an agent

Paste this prompt into Claude Code, Codex, Cursor or another agent — or into SourceWeft chat. The agent reads this server's install guide, shows you its publisher, endpoint and sign-in, and adds it to your client once you agree. Keys never go into a command.

Read https://sourceweft.com/mcp/io.github.nwjnjjj%2Fsmart-token-guard/install.md and connect the MCP server it describes to my client. Before changing any config, show me its publisher, endpoint and sign-in method and wait for my OK. Never put an API key in a command or in a file I would commit; ask me where it should come from.

Read the install guide the agent follows

Other MCP clients

Add this to your client's mcpServers config.

{
  "mcpServers": {
    "smarttokenguard": {
      "type": "http",
      "url": "https://stg-agent-560636228350.asia-east1.run.app/mcp",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      }
    }
  }
}

README

SmartTokenGuard

English · 简体中文

Stop burning credits on broken AI video.

Every black frame, frozen shot and off-model keyframe is money you already paid for. SmartTokenGuard checks each keyframe and clip from ComfyUI, Kling, Runway, Veo, Hailuo, Seedance or any other AI video tool the moment it renders, and tells your AI assistant whether it's worth paying for the next step: pass it, retry with exact fixes, switch models, or stop spending on that shot.

How much are broken renders costing you? Try the calculator: https://nwjnjjj.github.io/smart-token-guard/

ToolWhat it does
stg_inspect_renderMeasures an image or video: blur and soft focus, over/under-exposure, black frames, frozen segments, flicker, hard cuts, impacts and flashes, and colour/lighting drift against a reference image. Returns review frames so your assistant can check hands, faces and identity.
stg_qa_gateTurns measured issues + what the assistant saw into PASS / RETRY_SAME_MODEL / SWITCH_TO_FALLBACK / HALT / HALT_BUDGET, with concrete fixes (negative-prompt terms, lower motion, new seed). Keeps a spend ledger per project on your computer.
stg_detect_eventsExact frames of impacts, flashes and cuts, for placing sound effects.
stg_spend_reportWhat a project spent, attempts per passed shot, first-try pass rate, keyframes rejected before paying for video.
stg_account, stg_pricingLicense usage and plans.

Check the keyframe first. A rejected still costs nothing. A rejected 5-second clip has already been paid for.

How verdicts work: measured checks run automatically, and your assistant reviews the returned frames for hands, faces and identity before a render can PASS, so nothing broken slips through to the next paid step.

Plans

PlanMonthlyYearlyChecks per month
StarterUS$9US$99300
ProUS$29US$2903,000

Checks reset on the 1st of each month (UTC). One license per person; teams buy one per member. Checkout, tax and invoices are handled by Polar, the merchant of record. The license key in your Polar receipt is your API key. Cancel or change plans in the Polar customer portal. Run stg_pricing for the checkout links.

Install (MCP)

Requires uv.

Claude Desktop / Cursor: add to claude_desktop_config.json or ~/.cursor/mcp.json:

json
{  "mcpServers": {    "smart-token-guard": {      "command": "uvx",      "args": ["--from", "git+https://github.com/nwjnjjj/smart-token-guard", "smart-token-guard"],      "env": { "STG_LICENSE_KEY": "your-license-key" }    }  }}

Claude Code

bash
claude mcp add smart-token-guard -e STG_LICENSE_KEY=your-license-key -- uvx --from git+https://github.com/nwjnjjj/smart-token-guard smart-token-guard

VS Code: .vscode/mcp.json → {"servers": {"smart-token-guard": {"type": "stdio", "command": "uvx", "args": [...same...], "env": {...}}}}

Then ask: "Inspect renders/sh010_keyframe.png against refs/kai.png. If it passes, I'll render the clip on Kling (0.7 USD, fallback Runway)."

Python SDK

bash
pip install git+https://github.com/nwjnjjj/smart-token-guard
python
from smart_token_guard import Client
stg = Client()  # reads STG_LICENSE_KEYreport = stg.inspect("renders/sh010.mp4", reference_image="refs/kai.png")print(report["report"]["issues"], report["license"]["checks_remaining"])
decision = stg.qa_gate(model="Kling", render_cost_usd=0.7, technical_issues=report["report"]["issues"],                       semantic_defects=["deformed_hands"], fallback_model="Runway")print(decision["decision"], decision["actions"])

HTTP API: POST /v1/inspect (multipart file, optional reference, options JSON), POST /v1/qa-gate, GET /v1/account with Authorization: Bearer <license key>. See GET /v1/capabilities.

For AI agents (remote MCP and A2A)

No install needed. Media is passed as a public https URL; the server downloads it, analyses it and deletes it.

  • Remote MCP (Streamable HTTP): https://stg-agent-560636228350.asia-east1.run.app/mcp with header Authorization: Bearer <license key>. Tools: stg_inspect_media_url, stg_qa_gate, stg_account, stg_pricing.
  • A2A: Agent Card at https://stg-agent-560636228350.asia-east1.run.app/.well-known/agent-card.json, JSON-RPC message/send at /a2a. Send a data part {"media_url": "https://..."} (or text containing a link) to inspect, or {"skill": "qa-gate", ...} for a decision.
  • Same plans and monthly checks as above. URLs must be public https hosts; private and internal addresses are refused.

Limits and privacy

  • Up to 32 MB, 60 seconds and 1080p per file (JPEG, PNG, WebP, MP4, MOV, WebM, MKV). 30 requests per minute.
  • Files are uploaded to the SmartTokenGuard API (Google Cloud), analysed in a temporary file, and deleted before the response is sent. Nothing is stored and nothing is used for training.
  • The API receives your license key and the file. Project ledgers stay on your computer (~/.smart-token-guard/).
  • Measured checks catch technical render failures. They do not certify anatomy, identity, copyright or story quality.

Support

Refunds, invoices and cancellation: Polar customer portal (link in your receipt). The client code in this repository is MIT licensed; the hosted API requires a paid license.

Source: README.md at commit 9ab30ec

Tools

0
SourceWeft has not read this server's tools yet.

Version history

1
  1. v1.2.2LatestSep 16, 2026

Score

85% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 daysRequired25 pts
  • Auth declaredRequired10 pts
  • Tools listedRequired15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts