CLI to use DuckDuckGo AI Chat service from terminal
Based on the ideas of duckduckGO-chat-cli
For help, run:
duckchat --help
You can also use:
python -m duckchat --help
This produces.
usage: duckchat [-h] [-m {1,2,3,4,5}] [-y] [-q QUERY]
CLI to use DuckDuckGo AI Chat service from terminal
optional arguments:
-h, --help show this help message and exit
-m {1,2,3,4,5}, --model {1,2,3,4,5}
Select a model by key:
1: gpt-4o-mini
2: claude-3-haiku-20240307
3: meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo
4: mistralai/Mistral-Small-24B-Instruct-2501
5: o3-mini
-y, --yes If provided, means user accept terms of service.
-q QUERY, --query QUERY
First query to submit to the model
Now we can pass initial context when invoking a model with duckchat
cat app.py | duckchat --yes --model 4 --query "Explain this code"
or launch a model with an initial query
duckchat -y -m 4 -q "How to use pytest-vcr?"
Use duckchat without installing with uv
uv run --with duckduckgo-ai-chat duckchat
Now user can save their conversaions using the /save
command within the duckchat
interface.
And the saved file looks like this
Model Name | Actual Model | Performance | Recommended Usage | Characteristics |
---|---|---|---|---|
GPT-4o mini | gpt-4o-mini | Fast | Quick, simple tasks | Default model, Versatile |
Claude 3 Haiku | claude-3-haiku-20240307 | Balanced | Technical discussions | Good context handling, Structured responses |
Llama 3.3 70B | meta-llama/Llama-3.3-70B-Instruct-Turbo | Code optimized | Programming tasks | Documentation analysis, Code generation |
Mistral Small 3 | mistralai/Mistral-Small-24B-Instruct-2501 | Knowledge focused | Complex topics | Detailed explanations, In-depth analysis |
o3-mini | o3-mini | Very fast | Simple queries | Lightweight, Quick responses |
Install this tool using pip
:
pip install duckduckgo-ai-chat
To contribute to this tool, first checkout the code. Then create a new virtual environment:
cd duckduckgo-ai-chat
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
python -m pytest
By using this client you accept DuckDuckGo AI Chat ToS