A minimalist Python server that provides DuckDuckGo search functionality through a simple API.
- Clone the repository
git clone https://github.com/victorfu/4o-mini-server.git
- Install dependencies:
pip install -r requirements.txt
or
pip install fastapi uvicorn pyngrok python-dotenv httpx
- Set the NGROK_TOKEN environment variable:
export NGROK_TOKEN=<your_ngrok_token>
or create a .env
file in the root directory and add the following:
NGROK_TOKEN=<your_ngrok_token>
- Run the server:
python main.py
You can either run the commands directly:
!git clone https://github.com/victorfu/4o-mini-server.git
%cd 4o-mini-server/
!pip install fastapi uvicorn pyngrok python-dotenv httpx
!echo "NGROK_TOKEN=your_ngrok_token_here" > .env
!python main.py
Or use the provided shell script:
!wget https://raw.githubusercontent.com/victorfu/4o-mini-server/master/colab_setup.sh
!chmod +x colab_setup.sh
!./colab_setup.sh your_ngrok_token_here
The script requires your ngrok token as an argument. If you run it without the token, you'll see usage instructions:
./colab_setup.sh
# Error: NGROK_TOKEN is required
# Usage: ./colab_setup.sh <your_ngrok_token>
curl http://127.0.0.1:8000/api/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "Hello!"
}
],
"stream": false
}'
main.py
- Server implementationduckduckgo.py
- DuckDuckGo search integration
- Python 3.x
MIT License