Gemini 转OpenAI API格式

GitHub - PublicAffairs/openai-gemini:Gemini ➜ OpenAI API 代理。无服务器!

选择部署到 Cloudflare

填写帐户 ID和API 令牌

创建令牌

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_22/image_5bf52aa16d537ce3adee50f2790fc01d.png

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_22/image_838ff6b4bc0693271bdad844b12cd73a.png

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_22/image_c9772594d9fde2f711d667b7815ca61b.png

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_22/image_e79bd60f237d0a11fe07aec6cfd42aeb.png

填写帐户 ID和API 令牌

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_22/image_0e3245451a5d133b41a3c04f3b19e5d7.png

fork到自己的储存库并开启Github action功能

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_22/image_e6597f005cfa381b83274109599931a5.png

完成

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_22/image_9e1894c0f73a7d5980e5852e999cb36f.png

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_22/image_ce63eae69a071ff271886200b733aeb9.png

完成后进入到cloudflare 的Worker页面

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_22/image_20572f92e813c99565556a29e5dff5e6.png

找到刚刚创建的gemini

在设置中为其添加一个域名

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_22/image_22a58c37e0f588d0f69113636e0d3bd3.png

##Gemini API申请

现在中转服务已经部署,接下来是Gemini API申请: https://aistudio.google.com/

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_22/image_c7683203cc67aa5b0cda54417e4befcb.png

列出可用模型

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_22/image_21c448744a9da42af16bf6441d75060a.png