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

cortex-api-monitor

v5.0.1

Published

Advanced API rate limit monitoring with webhook notifications and analytics - TypeScript version

Readme

CortexAPI Monitor

🎯 Advanced API Rate Limit Monitoring - Claude API kullanım limitlerini izleyin, Discord webhook bildirimleri alın ve detaylı analitikler görün.

✨ Özellikler

  • 🔍 Gerçek Zamanlı İzleme - API kullanım limitlerini sürekli takip eder
  • 📊 Detaylı Analitikler - İstek başarı oranları, response süreleri ve hata analizi
  • 🔔 Discord Webhook - Rate limit artışlarında anında bildirim
  • 📈 Günlük Raporlar - Otomatik performans raporları
  • 💾 Persistent Veriler - Metrikler dosyada saklanır, restart'ta kaybolmaz
  • 🛡️ Gelişmiş Hata Yönetimi - Açık hata mesajları ve çözüm önerileri
  • 🖥️ CLI Interface - Kolay kurulum ve yönetim
  • 📦 Programmatik API - Kendi uygulamanızda kullanın

🚀 Hızlı Başlangıç

Global Kurulum

npm install -g cortex-api-monitor

İnteraktif Kurulum

cortex-api init

Hızlı Başlatma

cortex-api --api-key="sk-your-key" --webhook-url="your-discord-webhook"

📋 CLI Komutları

Temel Komutlar

# İnteraktif kurulum
cortex-api init

# Monitoring başlat
cortex-api start

# Durum görüntüle
cortex-api status

# Yardım
cortex-api help

Parametreli Başlatma

# Tüm parametrelerle
cortex-api start \
  --api-key="sk-your-claude-api-key" \
  --webhook-url="https://discord.com/api/webhooks/..." \
  --interval=30000 \
  --config="my-config.json"

# Direkt başlatma (start komutu olmadan)
cortex-api --api-key="sk-xxx" --webhook-url="https://discord.com/..."

Parametreler

| Parametre | Açıklama | Varsayılan | |-----------|----------|------------| | --api-key | Claude API anahtarınız | - | | --webhook-url | Discord webhook URL'i | - | | --interval | Kontrol aralığı (ms) | 30000 | | --config | Config dosya yolu | cortex-config.json |

🔧 Programmatik Kullanım

JavaScript/Node.js

const CortexAPI = require('cortex-api-monitor');

const monitor = new CortexAPI({
    apiKey: 'sk-your-claude-api-key',
    webhookUrl: 'https://discord.com/api/webhooks/...',
    checkInterval: 30000,
    dailyReportHour: 9
});

// Event listeners
monitor.on('start', () => {
    console.log('🎯 Monitor başlatıldı');
});

monitor.on('rateLimit', (data) => {
    console.log(`🚨 Rate limit artışı: +${data.increase}`);
    console.log(`📊 ${data.previous} → ${data.current}`);
});

monitor.on('check', (data) => {
    const { rateLimitInfo } = data;
    console.log(`📈 Kullanım: ${rateLimitInfo.used}/${rateLimitInfo.limit}`);
});

monitor.on('apiError', (data) => {
    console.error(`❌ API Hatası: ${data.type}`);
    console.error(data.message);
});

// Başlat
monitor.start();

// Durdur
monitor.stop();

Event Types

// Tüm event'ler
monitor.on('start', (data) => {});
monitor.on('stop', (data) => {});
monitor.on('check', (data) => {});
monitor.on('rateLimit', (data) => {});
monitor.on('webhookSent', (data) => {});
monitor.on('webhookError', (data) => {});
monitor.on('apiError', (data) => {});
monitor.on('error', (data) => {});

📊 Analitikler ve Metrikler

Otomatik Toplanan Veriler

  • İstek İstatistikleri: Toplam, başarılı, başarısız istek sayıları
  • Performance Metrikleri: Ortalama, min/max response süreleri
  • Uptime Bilgileri: Çalışma süresi, restart sayısı
  • Hata Analizi: Son hatalar ve türleri
  • Sistem Kaynakları: RAM kullanımı, process bilgileri

Metrik Dosyası

Tüm veriler cortex-metrics.json dosyasında saklanır:

{
  "startTime": 1695123456789,
  "totalRequests": 1250,
  "successfulRequests": 1248,
  "failedRequests": 2,
  "responseTimes": [245, 189, 267],
  "errors": [],
  "uptime": {
    "startTime": 1695123456789,
    "restarts": 3
  }
}

🔔 Discord Webhook Bildirimleri

Rate Limit Artış Bildirimi

{
  "embeds": [{
    "title": "Rate Limit Artışı Tespit Edildi!",
    "color": 16737131,
    "fields": [
      {
        "name": "Kullanım Değişimi",
        "value": "**Önceki:** 145\n**Mevcut:** 148\n**Artış:** +3"
      },
      {
        "name": "Limit Bilgileri", 
        "value": "**Limit:** 750\n**Kalan:** 602\n**Kullanım Oranı:** %19.7"
      }
    ]
  }]
}

Günlük Performans Raporu

Her gün belirlediğiniz saatte otomatik rapor gönderilir.

⚙️ Konfigürasyon

Config Dosyası (cortex-config.json)

{
  "apiKey": "sk-your-claude-api-key",
  "webhookUrl": "https://discord.com/api/webhooks/...",
  "checkInterval": 30000,
  "metricsFile": "cortex-metrics.json",
  "dailyReportHour": 9
}

🛡️ Hata Yönetimi

Otomatik Hata Çözümleri

  • Geçersiz API Key: Açık mesaj + çözüm önerisi
  • Rate Limit Aşımı: Otomatik bekleme ve tekrar deneme
  • Bağlantı Hataları: Otomatik yeniden bağlanma
  • Metrik Dosyası Bozulması: Otomatik backup + uyarı

Hata Türleri

  • INVALID_API_KEY - Geçersiz API anahtarı
  • RATE_LIMIT_EXCEEDED - Rate limit aşıldı
  • INSUFFICIENT_CREDITS - Yetersiz kredi
  • CONNECTION_ERROR - Bağlantı hatası
  • API_ERROR - Genel API hatası

📈 Durum Kontrolü

cortex-api status
CortexAPI Monitor Status

📋 Konfigürasyon:
   API Key: sk-e119aed...
   Webhook URL: https://discord.com/api/webhooks/...
   Kontrol Aralığı: 30000ms
   Günlük Rapor Saati: 9:00

📊 İstatistikler:
   Toplam İstek: 1,250
   Başarılı İstek: 1,248
   Başarı Oranı: %99.84
   Ortalama Response: 234ms
   Son Restart: 2 kez

📦 NPM Paketi

  • İsim: cortex-api-monitor
  • Versiyon: 1.0.5
  • Node.js: >=14.0.0

🤝 Katkıda Bulunma

  1. Fork yapın
  2. Feature branch oluşturun
  3. Commit yapın
  4. Push yapın
  5. Pull Request açın

📄 Lisans

MIT License

🔗 Bağlantılar

  • NPM: https://www.npmjs.com/package/cortex-api-monitor
  • GitHub: https://github.com/cortexapi/cortex-api-monitor

CortexAPI Monitor - Profesyonel API monitoring çözümü 🚀