DuckDuck is a JS Module for interacting with DuckDuckGo's chat and search APIs. It supports conversational AI chat.
- Supports Chat.
- Perform text-based searches using DuckDuckGo.
npm install
import { DuckDuck, CHAT_MODELS } from 'duckduckjs';
const duckduck = new DuckDuck();
const messages = [{ role: 'user', content: 'Tell me a joke.' }];
for await (const response of duckduck.chatYield(messages, CHAT_MODELS['gpt-4o-mini'])) {
console.log(response);
}
You can use the text()
function to perform text-based searches and get the results in plain text.
const results = await duckduck.text('latest AI news');
console.log(results);
Available models include:
gpt-4o-mini
llama-3.3-70b
claude-3-haiku
o3-mini
mistral-small-3
- Invalid_VQD Error: Rerun the chat or text function.
Other Issues or feature Request: Github
Contributions are welcome! Feel free to submit pull requests or issues.
Developed by Raj Dave.
Inspired by deedy5/duckduckgo_search
This library is not affiliated with DuckDuckGo and is for educational purposes only. It is not intended for commercial use or any purpose that violates DuckDuckGo's Terms of Service. By using this library, you acknowledge that you will not use it in a way that infringes on DuckDuckGo's terms. The official DuckDuckGo website can be found at https://duckduckgo.com.