{"id":31890592,"url":"https://github.com/luispater/aistudioproxyapihelper","last_synced_at":"2025-10-13T07:50:18.022Z","repository":{"id":293867580,"uuid":"985356969","full_name":"luispater/AIstudioProxyAPIHelper","owner":"luispater","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-17T16:33:31.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-17T16:33:44.380Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luispater.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-05-17T15:37:23.000Z","updated_at":"2025-05-17T16:33:03.000Z","dependencies_parsed_at":"2025-05-18T00:45:36.522Z","dependency_job_id":null,"html_url":"https://github.com/luispater/AIstudioProxyAPIHelper","commit_stats":null,"previous_names":["luispater/aistudioproxyapihelper"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/luispater/AIstudioProxyAPIHelper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luispater%2FAIstudioProxyAPIHelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luispater%2FAIstudioProxyAPIHelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luispater%2FAIstudioProxyAPIHelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luispater%2FAIstudioProxyAPIHelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luispater","download_url":"https://codeload.github.com/luispater/AIstudioProxyAPIHelper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luispater%2FAIstudioProxyAPIHelper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014159,"owners_count":26085464,"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-10-13T02:00:06.723Z","response_time":61,"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":[],"created_at":"2025-10-13T07:49:49.786Z","updated_at":"2025-10-13T07:50:18.017Z","avatar_url":"https://github.com/luispater.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [AIstudioProxyAPI](https://github.com/CJackHwang/AIstudioProxyAPI) Helper\n\nThis is a Man-in-the-Middle (MITM) proxy server implemented in Golang that can intercept AIStudio HTTPS requests and generate corresponding server certificates using a self-signed root certificate.\n\nIt's designed to work with [AIstudioProxyAPI](https://github.com/CJackHwang/AIstudioProxyAPI)\n\n## Features\n\n- Creates an HTTP proxy server (default port: 3120)\n- Intercepts HTTPS requests for Google domains (also can be configured)\n- Automatically Generates server certificates on-the-fly using a self-signed CA certificate\n- Parse AIStudio responses to OpenAI compatible format\n\n## Usage\n\n### Certificate Generation\n\nThe project includes pre-generated CA certificates and keys. If you need to regenerate them, you can use the following commands:\n\n```bash\nopenssl genrsa -out cert/ca.key 2048\nopenssl req -new -x509 -days 3650 -key cert/ca.key -out cert/ca.crt -subj \"/C=CN/ST=Shanghai/L=Shanghai/O=AiStudioProxyHelper/OU=CA/CN=AiStudioProxyHelper CA/emailAddress=ca@example.com\"\nopenssl rsa -in cert/ca.key -out cert/ca.key\n```\n\n### Building and Running\n\n```bash\n# Build the project\ngo build -o proxy-server\n\n# Run with default configuration\n./proxy-server\n\n# Run with custom parameters\n./proxy-server -port 3120 -api-port 3121 -sniff \"example.com,api.example.org,*.google.com\"\n\n# Run with upstream proxy server\n./proxy-server -proxy \"http://user:password@proxy.example.com:8080\"\n./proxy-server -proxy \"socks5://user:password@proxy.example.com:1080\"\n```\n\n### Command Line Arguments\n\n- `-port`: Proxy server port (default: 3120)\n- `-api-port`: API server port (default: 3121)\n- `-sniff`: Comma-separated list of domains to intercept\n- `-proxy`: Upstream proxy server URL (e.g., http://user:pass@host:port, https://host:port, socks4://host:port, socks5://user:pass@host:port)\n\n\n### Client Configuration\n\n1. Install the CA certificate (`cert/ca.crt`) into your client device's trusted root certificate store\n2. Configure your browser or system to use the proxy server (address: 127.0.0.1, port: 3120)\n\n### Viewing Sniffed Data\n\n```\ncurl -N -H \"Cookie: SAPISID=your_sapisid_value\" \\\nhttp://127.0.0.1:3121/getStreamResponse\n```\n\n### Viewing Sniffed Domains\n\n```\ncurl http://127.0.0.1:3121/getSniffDomains\n```\n\n### Adding Sniff Domains\n\n```\ncurl -X POST \\\n-H \"Content-Type: application/json\" \\\n-d '{\"domain\":\"example.com\"}' \\\nhttp://127.0.0.1:3121/addSniffDomain\n```\n\n### Deleting Sniff Domains\n\n```\ncurl -X POST \\\n-H \"Content-Type: application/json\" \\\n-d '{\"domain\":\"example.com\"}' \\\nhttp://127.0.0.1:3121/removeSniffDomain\n```\n\n\n## How It Works\n\nWhen a client connects to the proxy and attempts to establish an HTTPS connection:\n\n1. The proxy checks if the domain is in the list of domains to intercept\n2. If the domain should be intercepted:\n   - The proxy generates a certificate for the domain signed by its CA\n   - It establishes a TLS connection with the target server\n   - It establishes a TLS connection with the client using the generated certificate\n   - It forwards data between the client and server while recording the traffic\n3. If the domain is not in the intercept list, it simply forwards the connection\n\n## Technical Details\n\n- The proxy automatically handles AIStudio gzipped and chunked responses\n- For endpoints containing \"GenerateContent\", the proxy will record both request and response data\n- The proxy uses a certificate cache to improve performance for frequently accessed domains\n\n## Requirements\n\n- Go 1.24.0 or higher\n\n## License\n\n[MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluispater%2Faistudioproxyapihelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluispater%2Faistudioproxyapihelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluispater%2Faistudioproxyapihelper/lists"}