@x12i/ai-usage-sdk
v0.1.1
Published
SDK for AI coding-agent and API-platform usage/billing adapters, vault crypto, and allowlisted proxy core.
Maintainers
Readme
@x12i/ai-usage-sdk
Provider adapters, portable vault crypto, and an allowlisted usage-API proxy core for AI coding agents and API platforms.
Install
npm install @x12i/ai-usage-sdkQuick start
import {
PROVIDER_REGISTRY,
fetchProviderUsage,
createNodeProxyFetch,
} from "@x12i/ai-usage-sdk";
const proxyFetch = createNodeProxyFetch();
const snapshot = await fetchProviderUsage(
"openrouter",
{ apiKey: process.env.OPENROUTER_API_KEY! },
proxyFetch
);
console.log(snapshot.balanceRemaining, snapshot.balanceCurrency);What’s included
- Provider registry — Cursor, Claude Code, OpenAI, Anthropic, OpenRouter, and more
fetchProviderUsage— call any automated adapter with credentials- Proxy core —
forwardProxyRequest/ALLOWED_HOSTSfor Electron IPC or a localhost HTTP proxy - Vault crypto — PBKDF2 + AES-GCM helpers for portable password-protected backups
- Derived helpers — reset-date labels and group totals
Pair with @x12i/ai-usage-dashboard for the desktop app UI.
