Skip to content

xd-utkxrsh/AI-API-Wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI API Wrapper 🔗🤖

A minimal Flask-based API wrapper for OpenAI, with Swagger UI documentation support.

🚀 Features

  • Simple /generate endpoint to send prompts to OpenAI's Chat API.
  • Swagger UI at /docs for testing and visual documentation.
  • Uses environment variables for security.
  • Clean, professional folder structure.

📁 Folder Structure

AI-API-Wrapper/
│
├── app.py                  # Main Flask app
├── .env                   # Your OpenAI API Key
├── requirements.txt        # Dependencies
├── static/
│   └── swagger.json        # Swagger specification
├── templates/              # (Optional for HTML, not used here)
└── README.md

🔧 Setup Instructions

1. Clone & Navigate

git clone https://github.com/your-username/AI-API-Wrapper.git
cd AI-API-Wrapper

2. Create Virtual Environment (Optional but Recommended)

python -m venv venv
venv\Scripts\activate   # For Windows
source venv/bin/activate  # For Linux/Mac

3. Install Requirements

pip install -r requirements.txt

4. Add Environment Variable

Create a .env file:

OPENAI_API_KEY=your_openai_key_here

5. Run the App

python app.py

Go to: http://localhost:5000/docs for Swagger UI
or POST to http://localhost:5000/generate with JSON body.


🔍 Sample Request (cURL or Postman)

POST /generate
{
  "provider": "openai",
  "prompt": "Tell me a joke",
  "model": "gpt-3.5-turbo"
}

📦 Deployment Options

  • Railway
  • Render
  • EC2
  • Fly.io
  • Localhost

📘 License

MIT License. Use it freely.

About

Minimal Flask API Wrapper for OpenAI with Swagger UI integration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages