Quick Start
Build AI agents with any LLM provider in minutes.
Your First Agent
Section titled “Your First Agent”import { LLMist, Gadget, z } from 'llmist';
// 1. Define a tool (called "gadget" in llmist)class HighScore extends Gadget({ description: 'Records a high score to the eternal leaderboard', schema: z.object({ initials: z.string().length(3).describe('Player initials (3 characters)'), score: z.number().int().positive(), game: z.enum(['pac-man', 'galaga', 'donkey-kong', 'space-invaders']), }),}) { execute(params: this['params']): string { const { initials, score, game } = params; // In a real arcade, this would write to NVRAM return `${initials} scored ${score.toLocaleString()} on ${game}. A new challenger approaches!`; }}
// 2. Create and run agentconst answer = await LLMist.createAgent() .withModel('sonnet') .withGadgets(HighScore) .askAndCollect('I got 999,999 on Pac-Man! My initials are AAA.');
console.log(answer); // "AAA scored 999,999 on pac-man. A new challenger approaches!"Quick Methods (No Gadgets)
Section titled “Quick Methods (No Gadgets)”For simple completions without tools:
const answer = await LLMist.complete('What is the capital of France?');console.log(answer);for await (const chunk of LLMist.stream('Tell me a story')) { process.stdout.write(chunk);}Switching Models
Section titled “Switching Models”Use short aliases or full model names:
// Aliases (recommended).withModel('sonnet') // Anthropic Claude Sonnet.withModel('haiku') // Anthropic Claude Haiku.withModel('flash') // Google Gemini Flash.withModel('gpt5') // OpenAI GPT-5
// Full names with provider prefix.withModel('anthropic:claude-sonnet-4-5').withModel('openai:gpt-5')Next Steps
Section titled “Next Steps”- Creating Gadgets - Build custom tools
- Streaming - Handle real-time responses
- Hooks - Monitor and customize execution
- Gadget Examples - Common gadget patterns