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

netic-api

v1.0.0

Published

Package Node.js pour discuter avec Netic API

Downloads

103

Readme

Netic API Client

Un client Node.js moderne et complet pour communiquer avec l'API Netic AI.

Installation

npm install netic

Features

  • ✅ Chat texte simple
  • ✅ Support de l'historique de conversation
  • ✅ Envoi de fichiers audio (premium)
  • ✅ Gestion automatique du quota
  • ✅ Gestion robuste des erreurs
  • ✅ Configuration persistente de la clé API
  • ✅ TypeScript-friendly avec JSDoc

Utilisation rapide

Importation

import { NeticClient, chat, setApiKey } from 'netic';

Chat simple

import { chat } from 'netic';

try {
    const response = await chat("Bonjour, comment allez-vous ?", "netic_votre_api_key");
    console.log(response.response);
    console.log("Quota restant:", response.usage.remaining);
} catch (error) {
    console.error("Erreur:", error.message);
}

Avec la classe NeticClient

import { NeticClient } from 'netic';

const client = new NeticClient("netic_votre_api_key");

try {
    const response = await client.chat("Qu'est-ce que l'IA ?");
    console.log(response.response);
} catch (error) {
    console.error("Erreur:", error.message);
}

Configuration

Clé API persistente

import { setApiKey, getApiKey } from 'netic';

// Sauvegarder la clé API
setApiKey("netic_votre_api_key");

// Utiliser automatiquement la clé sauvegardée
const client = new NeticClient();

Fonctionnalités avancées

Historique de conversation

import { NeticClient } from 'netic';

const client = new NeticClient("netic_votre_api_key");

// L'historique est géré automatiquement
await client.chat("Je m'appelle Jean");
await client.chat("Comment tu m'appelles ?"); // L'IA se souvient !

// Voir l'historique
console.log(client.getHistory());

// Vider l'historique
client.clearHistory();

Historique personnalisé

const history = [
    { role: "user", content: "Je suis développeur" },
    { role: "assistant", content: "Intéressant !" }
];

const response = await client.chat("Quels frameworks ?", history);

Support audio (premium)

import { NeticClient } from 'netic';

const client = new NeticClient("netic_votre_api_key");

try {
    const response = await client.chatWithAudio({
        message: "Voici un message audio",
        audio: "/chemin/vers/fichier.webm"
    });
    
    console.log(response.response);
    if (response.audio_url) {
        console.log("Audio disponible:", response.audio_url);
    }
} catch (error) {
    if (error.message.includes('Audio feature not enabled')) {
        console.log("L'accès audio doit être activé par un admin");
    }
}

API complète

NeticClient

Constructor

  • new NeticClient(apiKey?: string) - Crée une instance cliente

Methods

  • setApiKey(key: string) - Définit la clé API
  • chat(message: string, history?: Array): Promise<Object> - Chat texte
  • chatWithAudio(options: Object): Promise<Object> - Chat avec audio
  • getHistory(): Array - Récupère l'historique
  • clearHistory() - Vide l'historique

Fonctions utilitaires

  • chat(message, apiKey?, history?) - Chat simple
  • chatWithAudio(options, apiKey?) - Chat audio simple
  • setApiKey(key) - Sauvegarde la clé API
  • getApiKey() - Récupère la clé API
  • clearApiKey() - Supprime la clé API
  • isValidApiKey(key) - Valide le format de la clé
  • formatHistory(history) - Formate l'historique

Réponse API

{
    response: "Réponse de l'IA",
    usage: {
        quota_used: 45,
        quota_limit: 1000,
        remaining: 955
    },
    user: "Nom utilisateur",
    audio_url: "/uploads/audio/..." // optionnel
}

Gestion des erreurs

Le client gère automatiquement tous les codes d'erreur :

  • 401 - Clé API invalide
  • 403 - Clé non approuvée ou audio non activé
  • 429 - Quota dépassé
  • 400 - Requête invalide
  • 500 - Erreur serveur
try {
    const response = await client.chat("Test");
} catch (error) {
    if (error.message.includes('Quota exceeded')) {
        console.log("Quota épuisé !");
    }
}

Exemples

Voir le dossier /examples pour des exemples complets :

  • examples/basic.js - Utilisation de base
  • examples/audio.js - Support audio
  • examples/advanced.js - Fonctionnalités avancées

Configuration

La clé API est sauvegardée dans ~/.netic/config.json.

Obtenir une clé API

  1. Connectez-vous sur https://netic.jtheberg.cloud
  2. Demandez une clé API dans le chat
  3. Attendez l'approbation admin
  4. Pour l'audio: contactez un admin pour l'activation

Licence

Jtheberg License use