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

@rethink-ai/core

v0.1.7

Published

Official TypeScript SDK for ReThink Core API

Readme

ReThink Core SDK

NPM Version License TypeScript R-Universe Labs

Official SDK untuk mengakses ReThink Core API dengan mudah dan efisien

Bahasa Indonesia | English Documentation


Dokumentasi Bahasa Indonesia

@rethink-ai/core adalah library client resmi yang dirancang untuk mempermudah integrasi dengan layanan AI dari ReThink Core. Mendukung text generation (streaming & non-streaming) serta image generation

🔑 Mendapatkan API Key

Sebelum memulai, Anda wajib memiliki API Key yang bisa didapatkan dengan cara:

  1. Kunjungi halaman ReThink Core
  2. Daftar akun baru atau login
  3. Masuk ke menu dashboard untuk menyalin API Key Anda

📦 Instalasi

Install package menggunakan npm, yarn, atau pnpm:

npm install @rethink-ai/core

🚀 Penggunaan Dasar

1. Inisialisasi Client

Import dan inisialisasi client. API Key bersifat wajib (dengan batasan tertentu untuk mengakses model berdasarkan tier)

import { rethink } from '@rethink-ai/core';

const client = new rethink({
  apiKey: 'YOUR_API_KEY_HERE' 
});

2. Generate Teks (Chat Completion)

Mendapatkan respons teks sederhana dari model AI

async function contohGenerateTeks() {
  try {
    const response = await client.text.generate({
      model: 'rethink-v1', // atau 'mistral', 'gpt-oss-120b', dll.
      prompt: 'Jelaskan apa itu nebula'
    });

    console.log('AI:', response.content);
    // Output: Nebula adalah...
  } catch (error) {
    console.error('Terjadi kesalahan:', error.message);
  }
}

3. Streaming Teks (Real-time)

Mendapatkan respons secara bertahap (per kata/chunk) seperti efek mengetik. Sangat disarankan untuk pengalaman pengguna yang lebih baik

async function contohStreaming() {
  try {
    const stream = await client.text.generate({
      model: 'rethink-v1',
      prompt: 'Buatkan puisi pendek tentang hujan.',
      stream: true // Aktifkan mode streaming
    });

    process.stdout.write('AI: ');
    
    // Loop async iterator
    for await (const chunk of stream) {
      process.stdout.write(chunk);
    }
    
    console.log('\n--- Selesai ---');
  } catch (error) {
    console.error('Error streaming:', error.message);
  }
}

4. Generate Gambar

Membuat gambar berdasarkan deskripsi teks (prompt)

async function contohGenerateGambar() {
  try {
    const response = await client.image.generate({
      model: 'flux', // Model gambar
      prompt: 'Buatkan gambar galaksi bima sakti',
      width: 1024,
      height: 768
    });

    console.log('URL Gambar:', response.url);
  } catch (error) {
    console.error('Gagal membuat gambar:', error.message);
  }
}

🛠️ Fitur Utama

  • Type-Safe: Dibangun dengan TypeScript, memberikan autocompletion dan validasi tipe yang kuat
  • Convenience Methods: API yang intuitif (text.generate, image.generate)
  • Streaming Support: Dukungan native untuk Server-Sent Events (SSE) yang mudah digunakan
  • Multi-Model: Akses ke berbagai model AI (OpenAI, Mistral, Gemini, Flux, dll) melalui satu interface

English Documentation

@rethink-ai/core is the official client library for integrating with ReThink Core AI services. It supports text generation (streaming & non-streaming) and image generation

🔑 Getting an API Key

Before starting, you must obtain an API Key:

  1. Visit ReThink Core
  2. Sign up for a new account or login
  3. Go to the dashboard to copy your API Key

📦 Installation

npm install @rethink-ai/core

🚀 Basic Usage

1. Client Initialization

import { rethink } from '@rethink-ai/core';

const client = new rethink({
  apiKey: 'YOUR_API_KEY_HERE'
});

2. Text Generation

const response = await client.text.generate({
  model: 'rethink-v1',
  prompt: 'Explain AI in one sentence.'
});
console.log(response.content);

3. Text Streaming

const stream = await client.text.generate({
  model: 'rethink-v1',
  prompt: 'Write a haiku about code.',
  stream: true
});

for await (const chunk of stream) {
  process.stdout.write(chunk);
}

4. Image Generation

const response = await client.image.generate({
  model: 'flux',
  prompt: 'Generate an image of milky way',
  width: 1024,
  height: 768
});
console.log(response.url);