Skip to content

An API for Javascript/Typescript with AI chat and search for text, using the DuckDuckGo.com search engine.

License

Notifications You must be signed in to change notification settings

RajDave-Dev/DuckDuckJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c24036a Β· Mar 24, 2025

History

3 Commits
Mar 24, 2025
Mar 24, 2025
Mar 24, 2025
Mar 24, 2025
Mar 24, 2025
Mar 24, 2025
Mar 24, 2025
Mar 24, 2025
Mar 24, 2025
Mar 24, 2025
Mar 24, 2025
Mar 24, 2025
Mar 24, 2025
Mar 24, 2025
Mar 24, 2025

πŸ¦† DuckDuck (DuckDuckGo Search)

DuckDuck is a JS Module for interacting with DuckDuckGo's chat and search APIs. It supports conversational AI chat.

⚑ Features

  • Supports Chat.
  • Perform text-based searches using DuckDuckGo.

πŸ›  Installation

npm install

πŸš€ Usage

πŸ“₯ Import DuckDuck Class

import { DuckDuck, CHAT_MODELS } from 'duckduckjs';

πŸ›Ž Initialize DuckDuck

const duckduck = new DuckDuck();

πŸ’¬ Start a Chat

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);
}

πŸ”Ž Perform a Text Search

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);

🧠 Models

Available models include:

  • gpt-4o-mini
  • llama-3.3-70b
  • claude-3-haiku
  • o3-mini
  • mistral-small-3

πŸ”Ž Troubleshooting

  • Invalid_VQD Error: Rerun the chat or text function.

Other Issues or feature Request: Github

🀝 Contributing

Contributions are welcome! Feel free to submit pull requests or issues.

πŸ§‘β€πŸ’» Author

Developed by Raj Dave.

Inspired by deedy5/duckduckgo_search

Disclaimer

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.