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

alwayscodex-api

v1.0.3

Published

Official Node.js & ESM SDK for AlwaysCodex REST API (https://api.alwayscodex.my.id) with automatic endpoint & category syncing

Readme

alwayscodex-api

Official Node.js & ES Module (ESM) SDK for AlwaysCodex REST API (https://api.alwayscodex.my.id).
Lightweight, zero-dependency, universal JavaScript client supporting AI models, downloaders, image tools, canvas generators, CORS proxy, binary media (image/audio/video) downloads, real-time SSE streaming (Agent API), file uploads, and AlightMotion Premium.


📦 Installation

npm install alwayscodex-api

🚀 Cara Import & Penggunaan

1. ES Modules (import)

import codex from "alwayscodex-api";

const api = codex({ apiKey: "YOUR_KEY" });

async function run() {
  const ai = await codex.ai.deepseek('Halo DeepSeek');
  console.log(ai);

  const gpt = await api.ai.gpt4({ text: 'Siapa penemu lampu?' });
  console.log(gpt);
}
run();

2. CommonJS (require)

const codex = require("alwayscodex-api");
const api = codex({ apiKey: "YOUR_KEY" });

async function run() {
  const ai = await codex.ai.deepseek('Halo dari CJS');
  console.log(ai);
}
run();

🔑 Tanpa API Key vs Dengan API Key

Tanpa API Key — Endpoint Gratis

const ai = await codex.ai.deepseek("Halo, siapa presiden pertama Indonesia?");
const tiktok = await codex.downloader.tiktok("https://vt.tiktok.com/xxxx");

Dengan API Key — Endpoint Premium

const api = codex({ apiKey: "YOUR_PREMIUM_KEY" });

const bulk = await api.am.bulk(1);
const hd = await api.imagehd.super_resolution("https://example.com/image.jpg");

🎨 5 Gaya Pemanggilan Fleksibel

| Gaya | Contoh | Hasil Path | |------|--------|-----------| | Dot notation | api.v4.chat.completions(...) | /api/v4/chat/completions | | CamelCase | api.v4.chatCompletions(...) | /api/v4/chat/completions | | snake_case | api.tools.password_generator(...) | /api/tools/password-generator | | kebab-case | api.tools["password-generator"](...) | /api/tools/password-generator | | Direct category | codex.imagehd(url) | default action |

const res1 = await codex.imagehd("https://example.com/img.jpg");
const res2 = await codex.maker.fakeNotif({ name: "Codex", message: "Hello!" });
const res3 = await codex.maker["fake-notif-wa"]({ name: "Codex", message: "Hello!" });

🧠 V4 Agent Gateway (OpenAI-compatible)

Support dot notation & camelCase:

const api = codex({ apiKey: "YOUR_KEY" });

// Daftar model
const models = await api.v4.models();
console.log(models.data);

// Chat completion
const chat = await api.v4.chat.completions({
  model: "auto",
  messages: [{ role: "user", content: "Halo" }],
  stream: false
});
console.log(chat.choices[0].message.content);

// Atau pake camelCase
const chat2 = await api.v4.chatCompletions({
  model: "auto",
  messages: [{ role: "user", content: "Halo" }]
});

⚡ AlightMotion Premium (AM)

const api = codex({ apiKey: "YOUR_KEY" });

// Kirim email verifikasi
await api.am.sendv2({ email: "[email protected]" });

// Verifikasi link
await api.am.verifyv2({ email: "[email protected]", link: "https://alight-creative..." });

// Bulk (max 100)
await api.am.bulk({ count: 5 });

📦 Handling Respons: JSON vs Image vs Video

SDK auto-detect Content-Type:

// JSON response
const ai = await codex.ai.gpt4("Apa ibukota Jepang?");
console.log(ai.result);

// Image response (Buffer)
const imgBuf = await codex.maker.fakeNotif({ name: "Bot", message: "Halo" });
fs.writeFileSync("output.jpg", imgBuf);

// Video response (Buffer)
const vidBuf = await codex.hdvidio["wink-hd-video"]({ url: "https://..." });
fs.writeFileSync("output.mp4", vidBuf);

⚡ Shortcut Methods

// GET
const getRes = await codex.get('/api/ai/gpt4', { teks: 'Halo' });

// POST
const postRes = await codex.post('/api/tools/password-generator', { length: 16 });

// Upload file
const uploadRes = await codex.upload('./gambar.png', { exp: 10, unit: 'menit' });

📝 Multiple Parameters

Semua parameter dikirim sebagai object — support jumlah parameter berapapun:

// 2 params
await api.am.verifyv2({ email: "[email protected]", link: "https://alight-creative..." });

// 3 params
await api.tools.spamOtp({ target: "0812xxx", jumlah: 5, delay: 1000 });

// Array + nested
await api.v4.chat.completions({
  model: "auto",
  messages: [{ role: "user", content: "Halo" }],
  temperature: 0.7,
  max_tokens: 2000,
  stream: false
});

// Parameter lewat string langsung (otomatis jadi parameter utama)
await api.ai.gemini("Halo");              // { teks: "Halo" }
await api.downloader.tiktok("https://..."); // { url: "https://..." }

⚙️ Opsi Inisialisasi

const api = codex({
  apiKey: "YOUR_KEY",           // API Key premium
  baseURL: "http://localhost:3000", // Custom base URL (default: https://api.alwayscodex.my.id)
  autoSync: false,              // Skip auto-sync endpoint
  timeout: 30000,               // Request timeout (ms)
});

⚠️ Catatan Error Handling

SDK tidak throw error untuk HTTP error response (4xx/5xx).
Response error dikembalikan dengan field _status dan _ok:

const res = await api.am.bulk({ count: 1 });
if (res._ok === false) {
  console.log(`Error ${res._status}: ${res.message}`);
}

📄 License

MIT © AlwaysCodex