npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tokyo-ai

v0.0.5

Published

Tokyo SDK Tracking Without Code Changes

Readme

🚀 Tokyo — AI Tracking SDK

Status: ✅ Production-Ready

Register : app.usetokyo.com/register

Tokyo SDK is a TypeScript-first client that enables seamless integration with multiple AI providers (OpenAI, Google Gemini, Anthropic Claude) using APIs that mirror their official SDKs — with automatic usage tracking and multi-tenant support.

✅ Supported Providers

| Provider | Status | Main Method | Example | |----------|--------|-------------|---------| | OpenAI | ✅ Production-Ready | client.responses.create() | client.responses.create({ model: "gpt-4o", messages: [...] }) | | Google Gemini | ✅ Production-Ready | client.models.generateContent() | client.models.generateContent({ model: "gemini-2.0-flash", contents: "..." }) | | Anthropic Claude | ✅ Production-Ready | client.messages.create() | client.messages.create({ model: "claude-3-sonnet", messages: [...] }) |

🎯 Key Features

  • 🔌 Native API compatibility – identical syntax to official provider SDKs
  • 🔑 Unified authentication – one Tokyo key for all providers
  • 💰 Automatic billing – built-in cost tracking per customer
  • TypeScript-first – full type safety and autocompletion
  • 🔄 Cross-provider fallback – retry on alternate providers automatically
  • 📊 Complete usage metrics – tokens, costs, request IDs, and more

📦 Installation

npm install tokyo-ai

🔧 Quick Setup

import { Tokyo, AI_PROVIDERS } from "tokyo-ai";

const client = new Tokyo(
  AI_PROVIDERS.openai, // or gemini, anthropic
  "sk_tokyo_your_key",
  { externalCustomerId: "your-customer-id" }
);

🌟 Why Choose Tokyo SDK?

🚀 Zero Code Changes

Drop-in replacement for native SDKs. Just update your import:

// Before (Native OpenAI)
import OpenAI from "openai";
const openai = new OpenAI({ apiKey: "sk-..." });

// After (Tokyo SDK)
import { Tokyo, AI_PROVIDERS } from "tokyo-ai";
const openai = new Tokyo(AI_PROVIDERS.openai, "sk_tokyo_...", { externalCustomerId: "123" });

// ✅ Same API, no logic changes

📊 Built-In Usage Tracking

  • Automatic token and cost tracking
  • Real-time metrics in the Tokyo dashboard
  • Per-customer billing out of the box

🔑 Unified Key Management

  • One Tokyo key for OpenAI, Gemini, Claude, and more
  • Keep provider API keys hidden and secure
  • Fine-grained permissions and limits

💡 Usage Examples

OpenAI API

const openai = new Tokyo(AI_PROVIDERS.openai, key, config);

const res = await openai.responses.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: "Tell me a joke." }]
});

console.log(res.choices[0].message.content);
console.log("Cost:", res.usage.cost);

Google Gemini

const gemini = new Tokyo(AI_PROVIDERS.gemini, key, config);

const res = await gemini.models.generateContent({
  model: "gemini-2.0-flash",
  contents: "Explain AI in one sentence."
});

console.log(res.candidates[0].content.parts[0].text);

Anthropic Claude

const claude = new Tokyo(AI_PROVIDERS.anthropic, key, config);

const res = await claude.messages.create({
  model: "claude-3-sonnet",
  messages: [{ role: "user", content: "What is quantum computing?" }]
});

console.log(res.content[0].text);

OpenAI Embeddings

const res = await openai.embeddings.create({
  model: "text-embedding-3-small",
  input: "Hello, world!"
});

console.log("Embedding length:", res.data[0].embedding.length);

🔄 Provider Switching

client.updateProvider(AI_PROVIDERS.gemini); // Switch dynamically

Or create multiple clients:

const openai = new Tokyo(AI_PROVIDERS.openai, key, config);
const gemini = new Tokyo(AI_PROVIDERS.gemini, key, config);

🛠 Advanced Configuration

const config = {
  externalCustomerId: "your-customer-id", // Required
  timeout: 30_000,
  retries: 3,
  debug: true,
  headers: { "X-Custom-Header": "value" }
};

🚀 Getting Started

  1. Register at usetokyo.com
  2. Create a project and configure providers
  3. Generate a Tokyo SDK key (sk_tokyo_...)
  4. Install and import tokyo-ai
  5. Use APIs with zero code changes

🚧 Limitations

  • Streaming: not yet supported (in development)
  • File uploads: partial support

🔮 Roadmap

  • ✅ OpenAI full API (incl. embeddings & images)
  • ✅ Gemini API
  • ✅ Anthropic API
  • ✅ Automatic billing & multi-tenancy
  • 🔄 Streaming responses (coming soon)
  • 🔄 Response caching
  • 🔄 Advanced analytics

📞 Support

📄 License

MIT License — see LICENSE.