| 模型 | 免费额度 | 上下文 | 多模态 |
| Gemini 1.5 Flash | 15 RPM | 100 万 token | ✅ 图片+文字 |
| Gemini 1.5 Pro | 2 RPM | 200 万 token | ✅ 图片+文字 |
| Gemini 2.0 Flash | 10 RPM | 100 万 token | ✅ 图片+文字 |
RPM = 每分钟请求数。15 RPM 对个人开发者完全够用。
注册教程
Step 1 · 准备
- 一个 Google 账号(Gmail)
- 代理(Gemini API 中国大陆不能直连)
Step 2 · 获取 API Key
1. 访问 Google AI Studio
2. 用 Google 账号登录
3. 点击 "Get API Key" → "Create API Key"
4. 选择一个 Google Cloud 项目(没有会自动创建)
5. 复制 API Key
Step 3 · 测试调用
import google.generativeai as genai
genai.configure(api_key="你的 Gemini API Key")
model = genai.GenerativeModel("gemini-1.5-flash")
response = model.generate_content("用 Python 写一个快排")
print(response.text)
或者用 OpenAI SDK 兼容格式(通过中转站):
from openai import OpenAI
client = OpenAI(
api_key="你的 openllmapi Key",
base_url="https://api.openllmapi.com"
)
response = client.chat.completions.create(
model="gemini-1.5-flash",
messages=[{"role": "user", "content": "Hello"}]
)
中国大陆怎么用?
Gemini API 中国大陆不能直连,有两种方案:
1. 代理 + 官方 API — 需要稳定代理
2. API 中转站 — openllmapi.com 支持 Gemini 全系列,中国大陆直连
Gemini 的独特优势
100 万 token 上下文 — 可以一次性分析整本书
免费多模态 — 图片理解不要钱
Google 生态集成 — 和 Google Docs、Sheets 等无缝配合
速度快 — Flash 模型响应极快
Gemini vs 竞品
| Gemini Flash | GPT-4o-mini | DeepSeek-V3 |
| 免费额度 | 15 RPM | 无(API) | $5 赠金 |
| 上下文 | 100 万 | 12.8 万 | 6.4 万 |
| 多模态 | ✅ | ✅ | ❌ |
| 中国大陆直连 | ❌ | ❌ | ✅ |
| 价格 | 免费 | $0.15/M | ¥0.14/M |