π Powerful Node.js Interface for DuckDuckGo AI Chat
Advanced Configuration β’ Intelligent Rate Limiting β’ Image Support β’ WebSearch
Installation β’ Quick Usage β’ Documentation β’ Examples
- GPT-4o mini - Versatile + WebSearch + Image Support
- Claude 3 Haiku - Excellent for creative writing
- Llama 3.3 70B - Optimized for programming
- Mistral Small - Advanced analysis and reasoning
- o4-mini - Ultra-fast for quick responses
- Intelligent rate limiting - Automatic protection
- Configurable tools - WebSearch, news, weather, local search
- Logging system - Debugging and monitoring
- Automatic retry - Robust error recovery
- Optimized presets - Ready-to-use configurations
- Simple messages - Intuitive API
- Real-time streaming - Progressive responses
- Multimodal support - Images with GPT-4o mini
- Persistent sessions - Conversation history
- Complete TypeScript - IntelliSense and validation
npm install duckduckgo-chat-interface
import { DuckDuckGoChat, Models } from 'duckduckgo-chat-interface';
const chat = new DuckDuckGoChat(Models.GPT4Mini);
await chat.initialize();
const response = await chat.sendMessage("Hello, how are you?");
console.log(response);
import { DuckDuckGoChat, ChatConfig, Models } from 'duckduckgo-chat-interface';
const config = ChatConfig.webSearchMode();
const chat = new DuckDuckGoChat(Models.GPT4Mini, config);
await chat.initialize();
chat.enableWebSearch();
const response = await chat.sendMessage("Latest AI news?");
console.log(response);
const images = [{
base64: imageBase64String,
mimeType: 'image/jpeg'
}];
const response = await chat.sendMessage("Describe this image", images);
console.log(response);
const response = await chat.sendMessageStream(
"Tell me a story",
(chunk) => process.stdout.write(chunk)
);
- π Quick Start - Get started in 5 minutes
- π API Reference - Complete API documentation
- π‘ Examples - Practical usage examples
Model | WebSearch | Images | Strength | Recommended Usage |
---|---|---|---|---|
GPT-4o mini | β | β | Versatile | General questions, search |
Claude 3 Haiku | β | β | Creativity | Writing, explanations |
Llama 3.3 70B | β | β | Technical | Code, programming |
Mistral Small | β | β | Logic | Analysis, reasoning |
o4-mini | β | β | Speed | Quick responses |
// WebSearch mode (GPT-4o mini)
const config = ChatConfig.webSearchMode();
// News mode
const config = ChatConfig.newsMode();
// Local mode (weather + local search)
const config = ChatConfig.localMode();
// High performance mode
const config = ChatConfig.highVolumeMode();
Explore detailed examples in the examples/
folder:
test.js
- Basic examples and configurationtest-advanced.js
- Advanced featurestest-simple.js
- Simple tests and validation
- Node.js : >= 14.0.0
- TypeScript : Full support with types
- ES Modules : Native ESM format
- Backward compatibility : 100% with 1.x versions
- WebSearch and images only with GPT-4o mini
- Rate limiting enabled by default to protect API
initialize()
required before sending messages- Automatic retry on temporary errors
- π Documentation : docs/
- π» Examples : examples/
- π Issues : GitHub Issues
- π¬ Discussions : GitHub Discussions
MIT License - see LICENSE for details.
π Ready to start?
Follow the Quick Start Guide!