Getting Started
Installation
bash
npm install billy-sdkRequires Node.js 18 or higher.
API Key
billy-sdk uses Groq's free API. Get your key at console.groq.com.
Option 1: Environment Variable (Recommended)
bash
export GROQ_API_KEY=gsk_your_api_key_hereFor local development, create a .env file in your project root:
bash
GROQ_API_KEY=gsk_your_api_key_hereThe
.envfile is automatically detected — no extra packages needed.
Option 2: CLI (Quick Setup)
bash
npx billy-sdk config set gsk_your_api_key_hereSaves to ~/.billy-sdk/config.json. Use npx billy-sdk config show to verify.
Option 3: In Code
javascript
import billy from "billy-sdk";
const IA = billy({ apiKey: "gsk_your_api_key_here" });Priority order: code > env var > .env file > config file
Quick Start
javascript
import billy from "billy-sdk";
const IA = billy();
// Generate content
await IA.create("genera 10 preguntas sobre la biblia");
console.log(IA.results);
// Analyze data
const datos = JSON.stringify([1, 2, 3, 4, 5]);
await IA.analyze(`dame estadísticas sobre ${datos}`);
console.log(IA.results);
// Extract information
const texto = "Contacto: Juan Pérez, juan@mail.com, +52 555 123 4567";
const info = await IA.asObject().extract(
`Extrae nombre, email y teléfono: ${texto}`,
);
console.log(info); // { nombre: "Juan Pérez", email: "juan@mail.com", telefono: "+52 555 123 4567" }