{"id":30655851,"url":"https://github.com/mrkorzun/ai_gateway_bot","last_synced_at":"2026-04-15T10:35:02.475Z","repository":{"id":312430309,"uuid":"1047476598","full_name":"mrkorzun/ai_gateway_bot","owner":"mrkorzun","description":"Telegram bot with full OpenAI API integration (Chat, Vision, Image). Supports model selection, user cabinet with balance top-up, auto billing (+50% markup), full request history, PostgreSQL, proxy support, and Docker/GitHub deployment.","archived":false,"fork":false,"pushed_at":"2025-08-30T14:12:59.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-30T16:09:26.095Z","etag":null,"topics":["ai-integration","ai-reseller","aiogram","billing","chatbot","chatgpt","dalle","docker","docker-compose","gpt-vision","openai","payments","postgresql","proxy","python","resell-ai","sqlalchemy","telegram-bot"],"latest_commit_sha":null,"homepage":"","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/mrkorzun.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-30T14:05:42.000Z","updated_at":"2025-08-30T14:20:50.000Z","dependencies_parsed_at":"2025-08-30T16:09:28.931Z","dependency_job_id":"3b58a608-88a7-432b-bd6c-6bcffb475f5f","html_url":"https://github.com/mrkorzun/ai_gateway_bot","commit_stats":null,"previous_names":["mrkorzun/ai_gateway_bot"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/mrkorzun/ai_gateway_bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkorzun%2Fai_gateway_bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkorzun%2Fai_gateway_bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkorzun%2Fai_gateway_bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkorzun%2Fai_gateway_bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrkorzun","download_url":"https://codeload.github.com/mrkorzun/ai_gateway_bot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkorzun%2Fai_gateway_bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272965497,"owners_count":25023071,"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","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","ai-reseller","aiogram","billing","chatbot","chatgpt","dalle","docker","docker-compose","gpt-vision","openai","payments","postgresql","proxy","python","resell-ai","sqlalchemy","telegram-bot"],"created_at":"2025-08-31T10:02:16.192Z","updated_at":"2026-04-15T10:35:02.406Z","avatar_url":"https://github.com/mrkorzun.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🤖 AI-Gateway-Bot\n\nTelegram bot with full OpenAI API integration designed for **reselling AI services**.  \nThe project provides a convenient interface for using Chat, Vision, and Image Generation models directly in Telegram, while handling billing, balance management, and request logging.\n\nThis bot is aimed at developers, entrepreneurs, and businesses that want to **monetize AI usage** without building everything from scratch.  \nIt includes a built-in billing system with a 50% markup, user cabinet for balance management, complete request history stored in PostgreSQL, and proxy support for stable API access.  \n\nDeployed with Docker/GitHub, the bot ensures scalable, maintainable, and production-ready infrastructure.  \n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/python-3.11%2B-blue.svg\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/aiogram-3.x-brightgreen.svg\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/OpenAI-API-orange.svg\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/PostgreSQL-16%2B-blue.svg\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/docker-ready-2496ED.svg\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/proxy-supported-important.svg\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/License-MIT-yellow.svg\" /\u003e\n\u003c/p\u003e\n\n\n---\n\n## 🚀 Features\n\n- 💬 **Chat** — interact with any selected OpenAI model.  \n- 👁 **Vision** — analyze an image (1 request → response → back to main menu).  \n- 🎨 **Image Generation (DALL·E)** — create images from prompts.  \n- 👤 **Personal Cabinet**:\n  - view user ID and balance,\n  - top-up balance via payment link,\n  - verify payment.  \n- ⚙️ **Model Selection** — switch between available models stored in the database.  \n- 💾 **Request History**:\n  - logs every request, user, cost, and tokens spent.  \n- 💸 **Monetization**:\n  - each model is priced **50% higher** than official OpenAI API rates,\n  - balance is deducted automatically.  \n- 🌐 **Proxy support** for stable API access.\n\n---\n\n## 💰 Pricing Model \u0026 Payments\n\n- Each OpenAI model is billed **50% higher** than the official OpenAI API price.  \n  Example: if the API price is $0.01, the user is charged $0.015.  \n- User balance is stored in the database and automatically deducted after each request.  \n- Payment workflow:\n  1. User clicks **Top Up Balance** in the Personal Cabinet.  \n  2. Enters the desired amount and receives a payment link.  \n  3. After payment, clicks **Verify Payment**:  \n     - if successful → balance is updated, success message is shown;  \n     - if failed → nothing changes.  \n- All transactions are logged (user ID, amount, status).  \n- Statistics dashboard will be available in the admin panel.\n\n---\n\n## 🛠 Tech Stack\n\n- Python 3.11+  \n- Aiogram (Telegram Bot API)  \n- OpenAI API (ChatGPT, GPT-Vision, DALL·E)  \n- PostgreSQL + SQLAlchemy + Alembic  \n- Docker + docker-compose  \n- GitHub Actions (CI/CD)  \n\n---\n\n## 📂 Project Structure\n\n```text\nrepo/\n├─ bot/          # Telegram handlers\n├─ services/     # business logic (balance, billing, AI)\n├─ providers/    # OpenAI API + proxy\n├─ db/           # SQLAlchemy models, Alembic migrations\n├─ admin/        # admin panel (stats, CRUD)\n├─ tests/        # unit tests\n├─ docker/       # Dockerfile and scripts\n├─ deploy/       # docker-compose.prod.yml and configs\n├─ .env.example  # example environment variables\n├─ README.md\n└─ requirements.txt\n```\n\n---\n\n## ⚙️ Installation \u0026 Run\n```bash\ngit clone https://github.com/\u003cyour-username\u003e/\u003crepo-name\u003e.git\ncd \u003crepo-name\u003e\n\ncp .env.example .env\n# fill in keys and settings\n\ndocker-compose up --build -d\n```\n\n---\n\n## 📊 Roadmap\n\n- [x] Basic Telegram bot\n- [ ] OpenAI API integration (chat/vision/image)\n- [ ] Personal cabinet + balance tracking\n- [ ] Balance top-up \u0026 payment verification\n- [ ] PostgreSQL + SQLAlchemy + Alembic\n- [ ] Token \u0026 cost tracking\n- [ ] Admin panel (stats, users)\n- [ ] Docker + server deployment\n- [ ] CI/CD via GitHub Actions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrkorzun%2Fai_gateway_bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrkorzun%2Fai_gateway_bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrkorzun%2Fai_gateway_bot/lists"}