Skip to content

victorfu/4o-mini-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

4o-mini-server

A minimalist Python server that provides DuckDuckGo search functionality through a simple API.

Quick Start

  1. Clone the repository
git clone https://github.com/victorfu/4o-mini-server.git
  1. Install dependencies:
pip install -r requirements.txt

or

pip install fastapi uvicorn pyngrok python-dotenv httpx
  1. 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>
  1. Run the server:
python main.py

Colab Installation

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>

API Usage

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
    }'

Project Structure

  • main.py - Server implementation
  • duckduckgo.py - DuckDuckGo search integration

Requirements

  • Python 3.x

License

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published