llm-lib demo
A unified JavaScript library for OpenAI, Anthropic, and Gemini
Configuration
Prompt
Response
Response will appear here...
Usage
import { LLM } from './llm-lib.js';
const llm = new LLM({
provider: 'openai',
apiKey: 'your-api-key',
model: 'gpt-4.1',
systemPrompt: 'You are helpful.'
});
const response = await llm.prompt('Hello!');
for await (const chunk of llm.stream('Tell me a story')) {
process.stdout.write(chunk);
}