{"id":28735226,"url":"https://github.com/alexbsoft/openai-proxy","last_synced_at":"2026-02-23T22:17:12.412Z","repository":{"id":279816729,"uuid":"940075132","full_name":"AlexBSoft/openai-proxy","owner":"AlexBSoft","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-05T06:20:58.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-05T07:23:27.143Z","etag":null,"topics":[],"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/AlexBSoft.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":"2025-02-27T15:18:30.000Z","updated_at":"2025-04-05T06:21:01.000Z","dependencies_parsed_at":"2025-02-27T22:07:18.456Z","dependency_job_id":"20c0d2f9-64d3-4d45-b839-e2618dc3c670","html_url":"https://github.com/AlexBSoft/openai-proxy","commit_stats":null,"previous_names":["alexbsoft/openai-proxy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AlexBSoft/openai-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexBSoft%2Fopenai-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexBSoft%2Fopenai-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexBSoft%2Fopenai-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexBSoft%2Fopenai-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexBSoft","download_url":"https://codeload.github.com/AlexBSoft/openai-proxy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexBSoft%2Fopenai-proxy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260072831,"owners_count":22954929,"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":[],"created_at":"2025-06-16T00:13:56.349Z","updated_at":"2026-02-23T22:17:12.344Z","avatar_url":"https://github.com/AlexBSoft.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenAI API Proxy\n\nA lightweight reverse proxy built with FastAPI that forwards requests to the OpenAI API, optionally through an HTTP proxy.\n\n## Features\n\n- Proxies all requests to the OpenAI API (configurable via environment variable)\n- Preserves all original request headers, methods, and body content\n- Supports streaming responses (SSE) for chat completions\n- Optionally routes traffic through an HTTP proxy if configured\n- Built with FastAPI for high performance\n- Minimal configuration required\n\n## Setup\n\n1. Configure environment variables:\n   Copy the `.env.example` file to `.env` and modify as needed:\n   ```\n   cp .env.example .env\n   ```\n\n2. Install dependencies:\n   ```\n   pip install -r requirements.txt\n   ```\n\n3. Run the application:\n   ```\n   python main.py\n   ```\n\n4. The proxy server will start on port 8080 by default (configurable via PORT environment variable)\n\n## Environment Variables\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| OPENAI_API_BASE_URL | Base URL for the OpenAI API | https://api.openai.com/ |\n| HTTP_PROXY | HTTP proxy URL (optional) | None |\n| PORT | Port to run the server on | 8080 |\n| DEBUG | Enable debug logging | False |\n\n## Usage\n\nSend your OpenAI API requests to this proxy instead of directly to OpenAI.\n\nExample:\n```bash\n# Instead of\ncurl https://api.openai.com/v1/chat/completions \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n  -d '{\"model\": \"gpt-3.5-turbo\", \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]}'\n\n# Use\ncurl http://localhost:8080/v1/chat/completions \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n  -d '{\"model\": \"gpt-3.5-turbo\", \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]}'\n```\n\n## Docker\n\nYou can also run the proxy using Docker:\n\n```bash\n# Build the Docker image\ndocker build -t openai-proxy .\n\n# Run the container\ndocker run -p 8080:8080 --env-file .env openai-proxy\n```\n\n## Notes\n\n- If HTTP_PROXY is set in the environment, all requests to the OpenAI API will be routed through this proxy\n- The proxy preserves all headers and request parameters\n- Streaming responses (like those from chat completions) are properly handled ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexbsoft%2Fopenai-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexbsoft%2Fopenai-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexbsoft%2Fopenai-proxy/lists"}