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

davidcyrilapi

v1.0.3

Published

Official Node.js/JS client for the David Cyril Tech API (apis.davidcyril.name.ng) — a thin HTTP wrapper, no local scraping logic bundled.

Readme

davidcyrilapi

npm version license node

Official JavaScript / Node.js client for the David Cyril Tech API — a single hosted API at https://apis.davidcyril.name.ng covering AI chat & image/video/music generation, media downloaders (YouTube, TikTok, Instagram, Facebook, Twitter, Spotify, etc.), anime/movie search, social boosting, temp mail/number services, url shorteners, games, tools (PDF, QR code, translate, upscaling, etc.), and more.

This package is a thin HTTP wrapper only — it does not bundle any scraping or backend logic. Every method simply builds a URL and calls it with the native fetch API. That means:

  • Zero dependencies, tiny install size.
  • Updates you ship on the API are available to every consumer instantly — no need to republish this package.
  • Your actual endpoint implementations stay private on your server; only the public HTTP surface is exposed here.
  • Works anywhere modern fetch is available: Node.js 18+, browsers, Deno, Bun, Cloudflare Workers, etc.

Table of Contents


Install

npm install davidcyrilapi

or with yarn / pnpm:

yarn add davidcyrilapi
pnpm add davidcyrilapi

Requirements: Node.js 18 or later (for native fetch / AbortController support). No other dependencies are installed.


Quick Start

const DavidCyrilAPI = require('davidcyrilapi');
// or with ES modules:
// import DavidCyrilAPI from 'davidcyrilapi';

const api = new DavidCyrilAPI();

const fact = await api.fact();
console.log(fact);

How It Works

Every route exposed by the API (e.g. GET /download/ytmp3, GET /ai/gpt-5, GET /anime/search) is mirrored as a JavaScript method on the client, grouped into namespaces that match the URL path segments:

| API route | SDK method | |------------------------|------------------------------| | /fact | api.fact() | | /random/quotes | api.random.quotes() | | /download/ytmp3 | api.download.ytmp3() | | /ai/gpt-5 | api.ai.gpt5() | | /anime/search | api.anime.search() | | /tools/qrcode | api.tools.qrcode() |

Calling any of these methods sends a GET request to https://apis.davidcyril.name.ng<path> with your parameters attached as a query string, and resolves with the parsed response body.

Hyphens and dots in route segments are converted to camelCase (e.g. /ai/gpt-5.1-instantapi.ai.gpt51Instant(), /ai/claude-sonnet-4.6api.ai.claudeSonnet46()).


Constructor Options

const api = new DavidCyrilAPI({
  baseUrl: 'https://apis.davidcyril.name.ng', // default — override for local/dev testing
  timeout: 30000,                             // request timeout in ms (default: 30000)
  fetchOptions: {},                           // extra options merged into every fetch() call
});

| Option | Type | Default | Description | |----------------|----------|-----------------------------------------|----------------------------------------------------------------------| | baseUrl | string | https://apis.davidcyril.name.ng | Base URL the client sends requests to. Useful for local/staging. | | timeout | number | 30000 | Milliseconds before a request is aborted. | | fetchOptions | object | {} | Extra options (e.g. custom headers) merged into every fetch() call. |


Calling Endpoints

Namespaced shortcut methods

Every known route is available as a method that mirrors its path. All methods accept a single optional object of query parameters:

const song = await api.download.ytmp3({ url: 'https://youtube.com/watch?v=...' });
const chat = await api.ai.gpt5({ q: 'Hello, how are you?' });
const results = await api.anime.search({ q: 'naruto' });
const qr = await api.tools.qrcode({ text: 'https://davidcyriltech.my.id' });

Generic call() method

If you add a brand-new endpoint to your API before this package is regenerated/updated, or you just prefer calling paths directly, use .call():

const result = await api.call('/some/new/endpoint', { foo: 'bar' });

api.call(path, params) is exactly what every shortcut method uses internally — it's a full escape hatch and always up to date with your live server.

Endpoints with URL parameters

Some routes contain a dynamic path segment, e.g. /aimusic/audio/:filename or /ai/music/remusic/status/:songId. For these, the SDK method takes the dynamic value as the first argument, followed by the (optional) query parameter object:

// GET /aimusic/audio/:filename
const audio = await api.aimusic.audio('track-123.mp3');

// GET /ai/music/remusic/status/:songId
const status = await api.ai.music.remusic.status('song_abc', { verbose: true });

Response Format

Every method returns a Promise that resolves with the API's response body:

  • If the response Content-Type / body is JSON, it is automatically parsed and returned as an object/array.
  • If the response is plain text or not valid JSON, the raw text string is returned instead.
const data = await api.fact();
console.log(typeof data); // 'object' if JSON, 'string' otherwise

Error Handling

If the API responds with a non-2xx status code, the returned promise rejects with an Error that has two extra properties attached:

  • error.status — the HTTP status code (e.g. 404, 500)
  • error.response — the parsed (or raw) response body, useful for reading the API's error message
try {
  const data = await api.download.ytmp3({ url: 'not-a-real-url' });
} catch (error) {
  console.error('Request failed:', error.message);
  console.error('Status code:', error.status);
  console.error('Server response:', error.response);
}

Network failures (DNS errors, timeouts, connection resets) reject with the underlying fetch/AbortController error.


TypeScript

Type definitions are bundled — no @types package needed.

import DavidCyrilAPI from 'davidcyrilapi';

const api = new DavidCyrilAPI({ timeout: 15000 });

async function run() {
  const fact: any = await api.fact();
  console.log(fact);
}

Because the API surface is large and evolving, endpoint methods are typed permissively (any) via an index signature, while the constructor, .call(), .baseUrl, and .timeout are fully typed.


Usage Examples

AI Chat

const gpt5 = await api.ai.gpt5({ q: 'Write a haiku about the ocean' });
const claude = await api.ai.claudeSonnet46({ q: 'Explain recursion simply' });
const gemini = await api.ai.gemini3Pro({ q: 'Summarize this article...' });

Media Downloaders

const ytMp3 = await api.download.ytmp3({ url: 'https://youtube.com/watch?v=...' });
const ytMp4 = await api.download.ytmp4({ url: 'https://youtube.com/watch?v=...' });
const tiktok = await api.download.tiktokv2({ url: 'https://tiktok.com/@user/video/...' });
const insta = await api.instagram({ url: 'https://instagram.com/p/...' });
const spotify = await api.download.spotdown({ url: 'https://open.spotify.com/track/...' });

Anime & Movies

const search = await api.anime.search({ q: 'one piece' });
const info = await api.anime.info({ id: '21' });
const trending = await api.anime.trending();
const movieSearch = await api.movies.search({ q: 'inception' });

Tools

const qr = await api.tools.qrcode({ text: 'https://davidcyriltech.my.id' });
const translated = await api.tools.translate({ text: 'Hello', to: 'fr' });
const weather = await api.tools.weather({ city: 'Abuja' });
const shortUrl = await api.shortenUrl({ url: 'https://example.com/very/long/path' });

Random / Fun

const quote = await api.random.quotes();
const joke = await api.api.games.joke();
const pickupLine = await api.pickupline();
const dare = await api.dare();

Browser Usage

Because the client uses only the native fetch API and URLSearchParams, it works directly in modern browsers via a bundler (Webpack, Vite, esbuild, etc.):

import DavidCyrilAPI from 'davidcyrilapi';

const api = new DavidCyrilAPI();
const fact = await api.fact();

Note: Calling the API directly from browser-side JavaScript will be subject to the API server's CORS policy. If you hit CORS errors in the browser, proxy requests through your own backend instead.


Timeouts & Aborting Requests

Every request is automatically aborted after timeout milliseconds (default 30000):

const api = new DavidCyrilAPI({ timeout: 10000 }); // 10 second timeout

try {
  await api.download.ytmp4({ url: '...' });
} catch (error) {
  if (error.name === 'AbortError') {
    console.error('Request timed out');
  }
}

Custom Fetch Options

Use fetchOptions to merge in custom headers or other fetch() init options on every request:

const api = new DavidCyrilAPI({
  fetchOptions: {
    headers: {
      'User-Agent': 'my-app/1.0',
    },
  },
});

FAQ

Does this package include any scraping code or API keys? No. It is a pure HTTP client — it only knows how to build URLs and parse responses. All logic lives on the API server at apis.davidcyril.name.ng.

Do I need an API key to use this? No API key is required for standard usage of the public endpoints.

What happens if the API adds a new endpoint after I've installed this package? Use the generic api.call('/new/endpoint', params) method — it works with any path immediately, without waiting for a package update. Named shortcut methods are added in future releases as the API grows.

Can I use this in a Cloudflare Worker / Deno / Bun project? Yes — it only depends on standard fetch, URLSearchParams, and AbortController, all of which are available in those runtimes.

Why do some methods have different names than the API path? Path segments are converted to camelCase for valid JavaScript identifiers (e.g. gpt-5.1-instantgpt51Instant). Refer to the How It Works table above, or just use api.call('/exact/path', params) if you'd rather not guess the generated name.


Contributing

Issues and pull requests are welcome. If you find an endpoint that isn't mapped correctly, please open an issue with the route path and expected method name.


License

MIT © David Cyril Tech