llm-lib demo

A unified JavaScript library for OpenAI, Anthropic, and Gemini

Configuration

Prompt

Response

Ready
Response will appear here...

Usage

// Include the library import { LLM } from './llm-lib.js'; // Create an instance const llm = new LLM({ provider: 'openai', // 'openai' | 'anthropic' | 'gemini' apiKey: 'your-api-key', model: 'gpt-4.1', systemPrompt: 'You are helpful.' }); // Non-streaming const response = await llm.prompt('Hello!'); // Streaming for await (const chunk of llm.stream('Tell me a story')) { process.stdout.write(chunk); }