DuckDuckGo AI to API
Chatting with DuckDuckGo AI through API,Free to use gpt-4o-mini,
claude-3-haiku, llama-3.1-70b, mixtral-8x7b, etc.
Supports continuous dialogue, compatible with OpenAI API format.
-
GET - /v1/models
-
POST - /v1/chat/completions
gpt-4o-mini
claude-3-haiku-20240307
meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo
mistralai/Mixtral-8x7B-Instruct-v0.1
Name | Option | Description |
---|---|---|
PORT |
Optional | Request port, default is 3000 |
API_KEYS |
Optional | API key group, separate multiple values with , |
PATH_PREFIX |
Optional | The actual endpoint URL should be prefixed with PATH_PREFIX after configuration, example: /PATH_PREFIX/v1/chat/completions |
-
*suggest manually setting
API_KEYS
*To deploy manually, go to thecf
branch -
*suggest manually setting
API_KEYS
-
docker run -d \ --name ddg2api \ -p 3000:3000 \ -e API_KEYS=your_api_key1,your_api_key2 \ -e TZ=Asia/Shanghai \ --restart always \ ghcr.io/meethuhu/ddg2api:main
-
services: ddg2api: image: ghcr.io/meethuhu/ddg2api:latest container_name: ddg2api ports: - '3000:3000' environment: - API_KEYS=your_api_key1,your_api_key2 - TZ=Asia/Shanghai restart: always
-
git clone https://github.com/meethuhu/DDG2API.git cd DDG2API npm install node index.js
# Get model list
curl http://localhost:3000/v1/models \
-H "Authorization: Bearer your_api_key"
# Send chat request
curl http://localhost:3000/v1/chat/completions \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "你好"}],
"stream": false
}'
- This project is for learning and research purposes only
- Please comply with DuckDuckGo's terms of use
- Recommended for use in local or private environments
- Please keep your keys secure
MIT License
Welcome to submit Issues and Pull Requests!