{"id":18068362,"url":"https://github.com/coslynx/openai-python-wrapper","last_synced_at":"2025-07-08T22:05:22.459Z","repository":{"id":260331826,"uuid":"880991278","full_name":"coslynx/OpenAI-Python-Wrapper","owner":"coslynx","description":"Streamlined API for simplified OpenAI requests, enabling efficient AI integration... Created at https://coslynx.com","archived":false,"fork":false,"pushed_at":"2024-10-30T18:18:50.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T16:12:30.787Z","etag":null,"topics":["ai-integration","api-client","asynchronous-programming","code-generation","data-validation","database-integration","developer-tools","devops","error-handling","fastapi","machine-learning","model-selection","mvp","mvp-development","openai-library","openai-wrapper","python","python-api","software-development","text-generation"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coslynx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-30T18:15:46.000Z","updated_at":"2024-10-30T18:18:53.000Z","dependencies_parsed_at":"2024-10-30T19:34:08.326Z","dependency_job_id":null,"html_url":"https://github.com/coslynx/OpenAI-Python-Wrapper","commit_stats":null,"previous_names":["coslynx/openai-python-wrapper"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/coslynx/OpenAI-Python-Wrapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coslynx%2FOpenAI-Python-Wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coslynx%2FOpenAI-Python-Wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coslynx%2FOpenAI-Python-Wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coslynx%2FOpenAI-Python-Wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coslynx","download_url":"https://codeload.github.com/coslynx/OpenAI-Python-Wrapper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coslynx%2FOpenAI-Python-Wrapper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264357296,"owners_count":23595576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-integration","api-client","asynchronous-programming","code-generation","data-validation","database-integration","developer-tools","devops","error-handling","fastapi","machine-learning","model-selection","mvp","mvp-development","openai-library","openai-wrapper","python","python-api","software-development","text-generation"],"created_at":"2024-10-31T08:06:11.169Z","updated_at":"2025-07-08T22:05:22.438Z","avatar_url":"https://github.com/coslynx.png","language":"Python","readme":"\u003cdiv class=\"hero-icon\" align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/PKief/vscode-material-icon-theme/ec559a9f6bfd399b82bb44393651661b08aaf7ba/icons/folder-markdown-open.svg\" width=\"100\" /\u003e\n\u003c/div\u003e\n\n\u003ch1 align=\"center\"\u003e\nOpenAI Python Wrapper\n\u003c/h1\u003e\n\u003ch4 align=\"center\"\u003eA Python backend service for seamless OpenAI API integration.\u003c/h4\u003e\n\u003ch4 align=\"center\"\u003eDeveloped with the software and tools below.\u003c/h4\u003e\n\u003cdiv class=\"badges\" align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Framework-FastAPI-blue\" alt=\"Framework used\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Language-Python-red\" alt=\"Programming Language\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Database-PostgreSQL-blue\" alt=\"Database used\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/LLMs-OpenAI-black\" alt=\"Large Language Models\"\u003e\n\u003c/div\u003e\n\u003cdiv class=\"badges\" align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/last-commit/coslynx/OpenAI-Python-Wrapper?style=flat-square\u0026color=5D6D7E\" alt=\"git-last-commit\" /\u003e\n  \u003cimg src=\"https://img.shields.io/github/commit-activity/m/coslynx/OpenAI-Python-Wrapper?style=flat-square\u0026color=5D6D7E\" alt=\"GitHub commit activity\" /\u003e\n  \u003cimg src=\"https://img.shields.io/github/languages/top/coslynx/OpenAI-Python-Wrapper?style=flat-square\u0026color=5D6D7E\" alt=\"GitHub top language\" /\u003e\n\u003c/div\u003e\n\n## 📑 Table of Contents\n- 📍 Overview\n- 📦 Features\n- 📂 Structure\n- 💻 Installation\n- 🏗️ Usage\n- 🌐 Hosting\n- 📄 License\n- 👏 Authors\n\n## 📍 Overview\n\nThis repository contains the backend code for the OpenAI Python Wrapper, a Python service designed to simplify the use of OpenAI's API for developers. This service offers a user-friendly interface for sending requests to OpenAI's API and receiving structured responses, making it easier for developers to integrate AI capabilities into their Python applications.\n\n## 📦 Features\n\n|    | Feature            | Description                                                                                                        |\n|----|--------------------|--------------------------------------------------------------------------------------------------------------------|\n| ⚙️ | **Architecture**   | The service follows a modular architectural pattern with separate directories for different functionalities, ensuring easier maintenance and scalability.             |\n| 📄 | **Documentation**  | This repository includes a README file that provides a detailed overview of the project, its dependencies, and usage instructions.  |\n| 🔗 | **Dependencies**   | The codebase relies on various external libraries and packages such as `fastapi`, `uvicorn`, `openai`, `pydantic`, and `sqlalchemy`, which are essential for building and managing the API, interacting with OpenAI, and managing data.  |\n| 🧩 | **Modularity**     | The modular structure allows for easier maintenance and reusability of the code, with separate directories and files for different functionalities such as services, routes, models, and utilities.  |\n| 🧪 | **Testing**        | Unit tests using `pytest` are implemented to ensure the reliability and robustness of the codebase.      |\n| ⚡️  | **Performance**    | The service is optimized for efficiency, leveraging asynchronous operations with FastAPI.  |\n| 🔐 | **Security**       |  Security is enhanced by implementing measures such as API key handling through environment variables and input validation using Pydantic.  |\n| 🔀 | **Version Control**| Utilizes Git for version control. |\n| 🔌 | **Integrations**   | The service seamlessly integrates with the OpenAI API and leverages the `openai` library for efficient interaction. |\n| 📶 | **Scalability**    | Designed for scalability, using a framework like FastAPI which supports asynchronous operations and can easily handle increased user load and data volume.   |\n\n## 📂 Structure\n\n```text\nopenai-python-wrapper/\n├── requirements.txt\n├── .env\n├── main.py\n├── models/\n│   └── base.py\n├── services/\n│   └── openai_service.py\n├── utils/\n│   └── openai_utils.py\n├── routes/\n│   └── api_routes.py\n├── tests/\n│   ├── test_routes.py\n│   ├── test_models.py\n│   ├── test_utils.py\n│   └── test_services.py\n├── commands.json\n├── startup.sh\n├── logging.conf\n└── .gitignore\n\n```\n\n## 💻 Installation\n\n### 🔧 Prerequisites\n\n- Python 3.9+\n- `pip` package manager\n- PostgreSQL (optional)\n\n### 🚀 Setup Instructions\n\n1. **Clone the repository:**\n   ```bash\n   git clone https://github.com/coslynx/OpenAI-Python-Wrapper.git\n   cd OpenAI-Python-Wrapper\n   ```\n\n2. **Install dependencies:**\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n3. **Set up environment variables:**\n   - Create a `.env` file in the project root and fill in the required values:\n     ```bash\n     OPENAI_API_KEY=YOUR_OPENAI_API_KEY_HERE\n     DATABASE_URL=postgresql://user:password@host:port/database\n     ```\n\n4. **(Optional) Set up the PostgreSQL database:**\n   - Follow the instructions for setting up PostgreSQL on your system.\n   - Update the `DATABASE_URL` in the `.env` file with your PostgreSQL connection details.\n\n## 🏗️ Usage\n\n### 🏃‍♂️ Running the MVP\n\n1. **Start the development server:**\n   ```bash\n   uvicorn app:app --host 0.0.0.0 --port 8000 --reload\n   ```\n\n## 🌐 Hosting\n\n### 🚀 Deployment Instructions\n\n#### Deploying to Heroku\n\n1. Install the Heroku CLI:\n   ```bash\n   npm install -g heroku\n   ```\n\n2. Login to Heroku:\n   ```bash\n   heroku login\n   ```\n\n3. Create a new Heroku app:\n   ```bash\n   heroku create OpenAI-Python-Wrapper-production\n   ```\n\n4. Set up environment variables:\n   ```bash\n   heroku config:set OPENAI_API_KEY=YOUR_OPENAI_API_KEY_HERE\n   heroku config:set DATABASE_URL=your_database_url_here\n   ```\n\n5. Deploy the code:\n   ```bash\n   git push heroku main\n   ```\n\n6. Run database migrations (if applicable):\n   ```bash\n   heroku run python manage.py migrate\n   ```\n\n### 🔑 Environment Variables\n\n- `OPENAI_API_KEY`: Your OpenAI API key.\n- `DATABASE_URL`: Connection string for your PostgreSQL database (if applicable).\n\n## 📜 API Documentation\n\n### 🔍 Endpoints\n\n- **POST /api/generate_text**\n  - Description: Generates text using OpenAI's API.\n  - Body:\n    ```json\n    {\n      \"prompt\": \"Write a short story about a cat.\",\n      \"model\": \"text-davinci-003\",\n      \"max_tokens\": 100\n    }\n    ```\n  - Response:\n    ```json\n    {\n      \"text\": \"Once upon a time, there was a fluffy cat named Mittens...\"\n    }\n    ```\n\n- **POST /api/translate_text**\n  - Description: Translates text between languages using OpenAI's API.\n  - Body:\n    ```json\n    {\n      \"text\": \"Hello, world!\",\n      \"target_language\": \"fr\"\n    }\n    ```\n  - Response:\n    ```json\n    {\n      \"translation\": \"Bonjour le monde !\"\n    }\n    ```\n\n- **POST /api/complete_code**\n  - Description: Completes code snippets using OpenAI's API.\n  - Body:\n    ```json\n    {\n      \"prompt\": \"def greet(name):\\n  print(\"\n    }\n    ```\n  - Response:\n    ```json\n    {\n      \"code\": \"def greet(name):\\n  print(f\\\"Hello, {name}!\\\")\"\n    }\n    ```\n\n\n## 📜 License \u0026 Attribution\n\n### 📄 License\n\nThis Minimum Viable Product (MVP) is licensed under the [GNU AGPLv3](https://choosealicense.com/licenses/agpl-3.0/) license.\n\n### 🤖 AI-Generated MVP\n\nThis MVP was entirely generated using artificial intelligence through [CosLynx.com](https://coslynx.com).\n\nNo human was directly involved in the coding process of the repository: OpenAI-Python-Wrapper\n\n### 📞 Contact\n\nFor any questions or concerns regarding this AI-generated MVP, please contact CosLynx at:\n- Website: [CosLynx.com](https://coslynx.com)\n- Twitter: [@CosLynxAI](https://x.com/CosLynxAI)\n\n\u003cp align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003e🌐 CosLynx.com\u003c/h1\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cem\u003eCreate Your Custom MVP in Minutes With CosLynxAI!\u003c/em\u003e\n\u003c/p\u003e\n\u003cdiv class=\"badges\" align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Developers-Drix10,_Kais_Radwan-red\" alt=\"\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Website-CosLynx.com-blue\" alt=\"\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Backed_by-Google,_Microsoft_\u0026_Amazon_for_Startups-red\" alt=\"\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Finalist-Backdrop_Build_v4,_v6-black\" alt=\"\"\u003e\n\u003c/div\u003e","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoslynx%2Fopenai-python-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoslynx%2Fopenai-python-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoslynx%2Fopenai-python-wrapper/lists"}