Give Vercel AI SDK a token-cost auditor
The TokenZero MCP server lets Vercel AI SDK audit the project it is working in for LLM token waste, price model alternatives at list prices, make a request body cache-friendly, and provision a workspace key, all in one tool call each.
Setup
createOpenAI({ baseURL: process.env.OPENAI_BASE_URL })
createAnthropic({ baseURL: process.env.ANTHROPIC_BASE_URL + "/v1" })Streaming responses end with a signed receipt trailer (an SSE comment), so usage is exact without a second call.
Tools
audit_repo_token_waste: static audit of a local directory, a public GitHub repo or a diff; runs locally, nothing uploaded.calculate_model_arbitrage: price a workload for the requested model and its cheaper sibling, with and without caching (table 2026-10-26).optimize_prompt_payload: rewrite an OpenAI or Anthropic request so its static prefix is provider-cacheable.provision_workspace: create a workspace and key with no form.
Protocol
Streamable HTTP at https://tokenzero.sh/mcp and stdio via npx -y @tokenzero/mcp. MCP 2026-07-28 (per-request _meta versioning, server/discover, typed results) with the initialize-era handshake still accepted for older clients.
Questions
Does Vercel AI SDK need a TokenZero account?
No. Audits and arbitrage run locally. optimize_prompt_payload and provision_workspace call the hosted service; the latter creates a free workspace.
Is my code uploaded?
No. The audit reads files locally and reports findings with file and line. Only a hosted audit of a public GitHub repository fetches code, from GitHub.