{"id":30927,"date":"2025-05-06T19:54:08","date_gmt":"2025-05-06T11:54:08","guid":{"rendered":"https:\/\/www.aisharenet.com\/?p=30927"},"modified":"2025-05-06T19:54:38","modified_gmt":"2025-05-06T11:54:38","slug":"aistudioproxyapi","status":"publish","type":"post","link":"https:\/\/www.kdjingpai.com\/de\/aistudioproxyapi\/","title":{"rendered":"AIstudioProxyAPI\uff1a\u65e0\u9650\u4f7f\u7528 Gemini 2.5 Pro \u6a21\u578b API"},"content":{"rendered":"<p>AIstudioProxyAPI \u662f\u4e00\u4e2a\u5f00\u6e90\u9879\u76ee\uff0c\u4f7f\u7528 Node.js \u548c Playwright \u6280\u672f\uff0c\u901a\u8fc7\u6a21\u62df OpenAI API \u7684\u65b9\u5f0f\uff0c\u5c06 <a href=\"https:\/\/www.kdjingpai.com\/google-ai-studioai\/\">Google AI Studio<\/a> \u7f51\u9875\u7248\u7684 <a href=\"https:\/\/www.kdjingpai.com\/geminibardgubu\/\">Gemini<\/a> \u6a21\u578b\u5bf9\u8bdd\u529f\u80fd\u8f6c\u6362\u4e3a\u6807\u51c6 API \u63a5\u53e3\u3002\u5f00\u53d1\u8005\u53ef\u4ee5\u5229\u7528\u8fd9\u4e2a\u4ee3\u7406\u670d\u52a1\uff0c\u8ba9\u652f\u6301 OpenAI API \u7684\u5ba2\u6237\u7aef\uff08\u5982 Open WebUI\u3001NextChat\uff09\u76f4\u63a5\u8bbf\u95ee Google <a href=\"https:\/\/www.kdjingpai.com\/google-ai-studioai\/\">AI Studio<\/a> \u7684\u65e0\u9650\u989d\u5ea6\u529f\u80fd\u3002\u9879\u76ee\u65e0\u9700\u590d\u6742\u914d\u7f6e\uff0c\u9002\u5408\u5e0c\u671b\u5feb\u901f\u96c6\u6210 Google AI Studio \u80fd\u529b\u7684\u5f00\u53d1\u8005\u3002\u5f53\u524d\u9879\u76ee\u4e3a\u4e2a\u4eba\u7ef4\u62a4\uff0c\u66f4\u65b0\u9891\u7387\u8f83\u4f4e\uff0c\u4e14\u4e0d\u652f\u6301\u65e0\u5934\u6a21\u5f0f\uff0c\u9700\u624b\u52a8\u786e\u4fdd Chrome \u8c03\u8bd5\u7aef\u53e3\u53ef\u7528\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u529f\u80fd\u5217\u8868<\/h2>\n<ul>\n<li>\u63d0\u4f9b\u00a0<code>\/v1\/chat\/completions<\/code>\u00a0\u548c\u00a0<code>\/v1\/models<\/code>\u00a0\u7aef\u70b9\uff0c\u517c\u5bb9 OpenAI API \u5ba2\u6237\u7aef\u3002<\/li>\n<li>\u652f\u6301\u6d41\u5f0f\u54cd\u5e94\uff08<code>stream=true<\/code>\uff09\uff0c\u5b9e\u73b0\u6253\u5b57\u673a\u6548\u679c\u3002<\/li>\n<li>\u652f\u6301\u975e\u6d41\u5f0f\u54cd\u5e94\uff08<code>stream=false<\/code>\uff09\uff0c\u4e00\u6b21\u6027\u8fd4\u56de\u5b8c\u6574 JSON\u3002<\/li>\n<li>\u81ea\u52a8\u4f18\u5316\u7528\u6237\u8f93\u5165\u63d0\u793a\u8bcd\uff0c\u9002\u914d Google AI Studio \u7684\u8f93\u51fa\u683c\u5f0f\u3002<\/li>\n<li>\u81ea\u52a8\u542f\u52a8\u5e76\u8fde\u63a5 Chrome \u5b9e\u4f8b\uff0c\u8bbe\u7f6e\u8c03\u8bd5\u7aef\u53e3\u548c\u7a97\u53e3\u5927\u5c0f\u3002<\/li>\n<li>\u63d0\u4f9b\u4ea4\u4e92\u5f0f\u9009\u9879\uff0c\u5904\u7406\u7aef\u53e3\u51b2\u7a81\u6216\u8fde\u63a5\u73b0\u6709 Chrome \u5b9e\u4f8b\u3002<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>\u4f7f\u7528\u5e2e\u52a9<\/h2>\n<h3>\u5b89\u88c5\u6d41\u7a0b<\/h3>\n<p>AIstudioProxyAPI \u90e8\u7f72\u7b80\u5355\uff0c\u4f46\u9700\u8981\u786e\u4fdd\u73af\u5883\u6b63\u786e\u914d\u7f6e\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li><strong>\u514b\u9686\u4ed3\u5e93<\/strong><br \/>\n\u5728\u7ec8\u7aef\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u83b7\u53d6\u9879\u76ee\u4ee3\u7801\uff1a<\/p>\n<pre><code>git clone https:\/\/github.com\/CJackHwang\/AIstudioProxyAPI\r\ncd AIstudioProxyAPI<\/code><\/pre>\n<\/li>\n<\/ol>\n<ol start=\"2\">\n<li><strong>\u5b89\u88c5\u4f9d\u8d56<\/strong><br \/>\n\u9879\u76ee\u4f9d\u8d56\u00a0<code>express<\/code>,\u00a0<code>cors<\/code>,\u00a0<code>playwright<\/code>\u00a0\u548c\u00a0<code>@playwright\/test<\/code>\u3002\u6839\u636e\u4f60\u7684\u5305\u7ba1\u7406\u5668\u9009\u62e9\u4ee5\u4e0b\u547d\u4ee4\u4e4b\u4e00\uff1a<\/p>\n<pre><code>npm install\r\n# \u6216\r\nyarn install\r\n# \u6216\r\npnpm install\r\n<\/code><\/pre>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f9d\u8d56\u4f1a\u81ea\u52a8\u914d\u7f6e\uff0c<code>@playwright\/test<\/code>\u00a0\u63d0\u4f9b\u65ad\u8a00\u529f\u80fd\u3002<\/li>\n<li><strong>\u542f\u52a8\u670d\u52a1<\/strong><br \/>\n\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8\u4ee3\u7406\u670d\u52a1\uff1a<\/p>\n<pre><code>node auto_connect_aistudio.cjs\r\n<\/code><\/pre>\n<p>\u8be5\u811a\u672c\u4f1a\uff1a<\/p>\n<ul>\n<li>\u68c0\u67e5\u4f9d\u8d56\u662f\u5426\u5b8c\u6574\u3002<\/li>\n<li>\u9a8c\u8bc1 Chrome \u8c03\u8bd5\u7aef\u53e3\uff08\u9ed8\u8ba4\u00a0<code>8848<\/code>\uff09\u662f\u5426\u7a7a\u95f2\u3002<\/li>\n<li>\u8bbe\u7f6e Chrome \u7a97\u53e3\u5927\u5c0f\uff08\u9ed8\u8ba4\u5bbd\u5ea6\u00a0<code>460px<\/code>\uff09\u3002<\/li>\n<li>\u81ea\u52a8\u542f\u52a8 Chrome \u5e76\u6253\u5f00 Google AI Studio \u9875\u9762\u3002<\/li>\n<\/ul>\n<p>\u5982\u679c\u7aef\u53e3\u88ab\u5360\u7528\uff0c\u811a\u672c\u4f1a\u63d0\u793a\u9009\u62e9\u8fde\u63a5\u73b0\u6709 Chrome \u5b9e\u4f8b\u6216\u6e05\u7406\u7aef\u53e3\u540e\u91cd\u8bd5\u3002\u786e\u4fdd\u624b\u52a8\u767b\u5f55 Google AI Studio \u9875\u9762\u5b8c\u6210\u8eab\u4efd\u9a8c\u8bc1\u3002<\/li>\n<\/ol>\n<h3>\u4f7f\u7528\u4e3b\u8981\u529f\u80fd<\/h3>\n<p>AIstudioProxyAPI \u7684\u6838\u5fc3\u662f\u5c06 Google AI Studio \u7684 Gemini \u6a21\u578b\u80fd\u529b\u901a\u8fc7 OpenAI API \u517c\u5bb9\u63a5\u53e3\u63d0\u4f9b\u7ed9\u5ba2\u6237\u7aef\u3002\u4ee5\u4e0b\u662f\u64cd\u4f5c\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li><strong>\u914d\u7f6e\u5ba2\u6237\u7aef<\/strong><br \/>\n\u5728\u652f\u6301 OpenAI API \u7684\u5ba2\u6237\u7aef\uff08\u5982 Open WebUI\uff09\u4e2d\uff0c\u5c06 API \u5730\u5740\u8bbe\u7f6e\u4e3a\u4ee3\u7406\u670d\u52a1\u7684\u5730\u5740\uff08\u9ed8\u8ba4\u00a0<code>http:\/\/localhost:2048<\/code>\uff09\u3002\u65e0\u9700\u66f4\u6539\u5ba2\u6237\u7aef\u4ee3\u7801\uff0c\u63a5\u53e3\u5b8c\u5168\u517c\u5bb9\u3002<\/li>\n<li><strong>\u53d1\u9001\u5bf9\u8bdd\u8bf7\u6c42<\/strong><br \/>\n\u4f7f\u7528\u5ba2\u6237\u7aef\u53d1\u9001\u5bf9\u8bdd\u8bf7\u6c42\uff0c\u683c\u5f0f\u4e0e OpenAI API \u4e00\u81f4\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code>{\r\n\"model\": \"gemini\",\r\n\"messages\": [\r\n{\"role\": \"system\", \"content\": \"\u4f60\u662f\u4e00\u4e2a\u52a9\u624b\"},\r\n{\"role\": \"user\", \"content\": \"\u8bf7\u89e3\u91ca\u91cf\u5b50\u529b\u5b66\"}\r\n],\r\n\"stream\": true\r\n}\r\n<\/code><\/pre>\n<ul>\n<li>\u8bbe\u7f6e\u00a0<code>stream=true<\/code>\u00a0\u83b7\u53d6\u6d41\u5f0f\u54cd\u5e94\uff0c\u9002\u5408\u5b9e\u65f6\u5bf9\u8bdd\u3002<\/li>\n<li>\u8bbe\u7f6e\u00a0<code>stream=false<\/code>\u00a0\u83b7\u53d6\u5b8c\u6574 JSON \u54cd\u5e94\uff0c\u9002\u5408\u4e00\u6b21\u6027\u5904\u7406\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u4f18\u5316\u63d0\u793a\u8bcd<\/strong><br \/>\n\u4ee3\u7406\u670d\u52a1\u4f1a\u81ea\u52a8\u5305\u88c5\u7528\u6237\u8f93\u5165\uff0c\u6dfb\u52a0\u7279\u5b9a\u6807\u8bb0\uff08\u5982\u00a0<code>&lt;&lt;&lt;START_RESPONSE&gt;&gt;&gt;<\/code>\uff09\uff0c\u786e\u4fdd Google AI Studio \u8f93\u51fa\u7b26\u5408\u9884\u671f\u683c\u5f0f\u3002\u5f00\u53d1\u8005\u65e0\u9700\u624b\u52a8\u8c03\u6574\u63d0\u793a\u8bcd\u3002<\/li>\n<li><strong>\u7ba1\u7406 Chrome \u5b9e\u4f8b<\/strong><br \/>\n\u542f\u52a8\u540e\uff0cChrome \u7a97\u53e3\u5fc5\u987b\u4fdd\u6301\u6253\u5f00\uff0c\u4e14 Google AI Studio \u9875\u9762\u4e0d\u80fd\u5d29\u6e83\u3002\u5982\u679c\u9875\u9762\u65e0\u54cd\u5e94\uff0c\u53ef\u5173\u95ed\u6240\u6709\u76f8\u5173\u8fdb\u7a0b\uff08<code>node<\/code>\u00a0\u548c\u00a0<code>chrome<\/code>\uff09\uff0c\u91cd\u65b0\u8fd0\u884c\u00a0<code>node auto_connect_aistudio.cjs<\/code>\u3002<\/li>\n<\/ol>\n<h3>\u7279\u8272\u529f\u80fd\u64cd\u4f5c<\/h3>\n<ul>\n<li><strong>\u6d41\u5f0f\u54cd\u5e94<\/strong>\uff1a\u5728\u5ba2\u6237\u7aef\u8bbe\u7f6e\u00a0<code>stream=true<\/code>\uff0c\u54cd\u5e94\u4f1a\u4ee5\u6253\u5b57\u673a\u6548\u679c\u9010\u5b57\u663e\u793a\uff0c\u9002\u5408\u4ea4\u4e92\u5f0f\u5e94\u7528\u3002<\/li>\n<li><strong>\u7aef\u53e3\u51b2\u7a81\u5904\u7406<\/strong>\uff1a\u811a\u672c\u68c0\u6d4b\u5230\u00a0<code>8848<\/code>\u00a0\u7aef\u53e3\u5360\u7528\u65f6\uff0c\u4f1a\u63d0\u793a\u7528\u6237\u9009\u62e9\u8fde\u63a5\u73b0\u6709 Chrome \u5b9e\u4f8b\u6216\u6e05\u7406\u7aef\u53e3\u3002<\/li>\n<li><strong>\u7a97\u53e3\u5927\u5c0f\u8c03\u6574<\/strong>\uff1a\u5982\u679c\u00a0<code>460px<\/code>\u00a0\u5bbd\u5ea6\u4e0d\u9002\u914d\u663e\u793a\u5668\uff0c\u53ef\u4fee\u6539\u00a0<code>auto_connect_aistudio.cjs<\/code>\u00a0\u4e2d\u7684\u00a0<code>--window-size<\/code>\u00a0\u53c2\u6570\u3002<\/li>\n<\/ul>\n<h3>\u5e38\u89c1\u95ee\u9898\u6392\u67e5<\/h3>\n<ul>\n<li><strong>\u9875\u9762\u52a0\u8f7d\u5931\u8d25<\/strong>\uff1a\u68c0\u67e5\u7f51\u7edc\u8fde\u63a5\uff0c\u5c1d\u8bd5\u624b\u52a8\u8bbf\u95ee\u00a0<code>https:\/\/aistudio.google.com\/prompts\/new_chat<\/code>\u00a0\u5e76\u767b\u5f55\u3002<\/li>\n<li><strong>\u7aef\u53e3\u5360\u7528<\/strong>\uff1a\u8fd0\u884c\u00a0<code>lsof -i :2048<\/code>\u00a0\u68c0\u67e5\u5360\u7528\u7a0b\u5e8f\uff0c\u5173\u95ed\u6216\u66f4\u6539\u00a0<code>server.cjs<\/code>\u00a0\u4e2d\u7684\u00a0<code>SERVER_PORT<\/code>\u3002<\/li>\n<li><strong>Playwright \u672a\u5c31\u7eea<\/strong>\uff1a\u786e\u4fdd Chrome \u7a97\u53e3\u672a\u5173\u95ed\uff0c\u91cd\u65b0\u8fd0\u884c\u542f\u52a8\u811a\u672c\u3002<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>\u5e94\u7528\u573a\u666f<\/h2>\n<ol>\n<li><strong>\u5feb\u901f\u96c6\u6210 AI \u5bf9\u8bdd\u529f\u80fd<\/strong><br \/>\n\u5f00\u53d1\u8005\u60f3\u5728\u5e94\u7528\u4e2d\u6dfb\u52a0 AI \u5bf9\u8bdd\u529f\u80fd\uff0c\u4f46\u53d7\u9650\u4e8e OpenAI API \u7684\u914d\u989d\u3002AIstudioProxyAPI \u8ba9\u5f00\u53d1\u8005\u5229\u7528 Google AI Studio \u7684\u514d\u8d39\u989d\u5ea6\uff0c\u901a\u8fc7\u719f\u6089\u7684 OpenAI API \u63a5\u53e3\u5feb\u901f\u5b9e\u73b0\u529f\u80fd\u3002<\/li>\n<li><strong>\u672c\u5730\u5f00\u53d1\u4e0e\u6d4b\u8bd5<\/strong><br \/>\n\u5f00\u53d1\u56e2\u961f\u5728\u672c\u5730\u73af\u5883\u4e2d\u6d4b\u8bd5 AI \u5bf9\u8bdd\u529f\u80fd\u65f6\uff0c\u53ef\u901a\u8fc7 AIstudioProxyAPI \u6a21\u62df OpenAI API\uff0c\u65e0\u9700\u989d\u5916\u8d2d\u4e70 API \u914d\u989d\uff0c\u964d\u4f4e\u6210\u672c\u3002<\/li>\n<li><strong>\u6559\u80b2\u4e0e\u7814\u7a76<\/strong><br \/>\n\u5b66\u751f\u6216\u7814\u7a76\u4eba\u5458\u9700\u8981\u5b9e\u9a8c\u5927\u6a21\u578b\u5bf9\u8bdd\u529f\u80fd\uff0c\u4f46\u7f3a\u4e4f API \u8bbf\u95ee\u6743\u9650\u3002AIstudioProxyAPI \u63d0\u4f9b\u7b80\u5355\u65b9\u5f0f\u8bbf\u95ee Gemini \u6a21\u578b\uff0c\u9002\u5408\u5b66\u672f\u7814\u7a76\u3002<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h2>QA<\/h2>\n<ol>\n<li><strong>AIstudioProxyAPI \u652f\u6301\u54ea\u4e9b\u5ba2\u6237\u7aef\uff1f<\/strong><br \/>\n\u4efb\u4f55\u652f\u6301 OpenAI API \u7684\u5ba2\u6237\u7aef\uff08\u5982 Open WebUI\u3001NextChat\uff09\u90fd\u53ef\u4f7f\u7528\uff0c\u65e0\u9700\u4fee\u6539\u5ba2\u6237\u7aef\u4ee3\u7801\u3002<\/li>\n<li><strong>\u4e3a\u4ec0\u4e48\u4e0d\u652f\u6301\u65e0\u5934\u6a21\u5f0f\uff1f<\/strong><br \/>\nGoogle AI Studio \u7684\u81ea\u52a8\u5316\u68c0\u6d4b\u9650\u5236\u4e86\u65e0\u5934\u6a21\u5f0f\uff0c\u9700\u4f7f\u7528\u6709\u754c\u9762 Chrome \u5b9e\u4f8b\u3002<\/li>\n<li><strong>\u5982\u4f55\u5904\u7406\u7aef\u53e3\u88ab\u5360\u7528\uff1f<\/strong><br \/>\n\u68c0\u67e5\u00a0<code>2048<\/code>\u00a0\u6216\u00a0<code>8848<\/code>\u00a0\u7aef\u53e3\u5360\u7528\u60c5\u51b5\uff0c\u5173\u95ed\u51b2\u7a81\u7a0b\u5e8f\u6216\u4fee\u6539\u00a0<code>server.cjs<\/code>\u00a0\u4e2d\u7684\u7aef\u53e3\u914d\u7f6e\u3002<\/li>\n<li><strong>\u670d\u52a1\u662f\u5426\u9700\u8981\u6301\u7eed\u8054\u7f51\uff1f<\/strong><br \/>\n\u662f\u7684\uff0c\u4ee3\u7406\u670d\u52a1\u9700\u8054\u7f51\u8bbf\u95ee Google AI Studio \u9875\u9762\uff0c\u786e\u4fdd\u9875\u9762\u6b63\u5e38\u52a0\u8f7d\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>AIstudioProxyAPI \u662f\u4e00\u4e2a\u5f00\u6e90\u9879\u76ee\uff0c\u4f7f\u7528 Node.js \u548c Playwright \u6280\u672f\uff0c\u901a\u8fc7\u6a21\u62df OpenAI API \u7684\u65b9\u5f0f\uff0c\u5c06 Google AI Studio \u7f51\u9875\u7248\u7684 Gemini \u6a21\u578b\u5bf9\u8bdd\u529f\u80fd\u8f6c\u6362\u4e3a\u6807\u51c6 API \u63a5&#8230;<\/p>\n","protected":false},"author":1,"featured_media":62329,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[230,255],"class_list":["post-30927","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tool","tag-aikaiyuanxiangmu","tag-mianfeidamoxingapi"],"_links":{"self":[{"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/posts\/30927","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/comments?post=30927"}],"version-history":[{"count":0,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/posts\/30927\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/media\/62329"}],"wp:attachment":[{"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/media?parent=30927"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/categories?post=30927"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/tags?post=30927"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}