总目录 大模型相关研究:https://blog.csdn.net/WhiffeYF/article/details/142132328
今天偶然发现Gemini的API有免费额度(2025-12-24)
https://ai.google.dev/gemini-api/docs/pricing?hl=zh-cn
b站视频:https://www.bilibili.com/video/BV1NQBLB7EDU
免费API一览
最好的模型没有免费额度,但是轻量版/过去的模型就有免费额度。
调用API
API位置:
https://aistudio.google.com/api-keys
入门教程:
https://ai.google.dev/gemini-api/docs/quickstart?hl=zh-cn
pipinstall-q -U google-genai导入你的API
exportGEMINI_API_KEY=<YOUR_API_KEY_HERE>fromgoogleimportgenai# The client gets the API key from the environment variable `GEMINI_API_KEY`.client=genai.Client()response=client.models.generate_content(model="gemini-2.5-flash",contents="Explain how AI works in a few words")print(response.text)运行结果如下:
感动,竟然真的免费。
调用gemini-3-flash-preview
fromgoogleimportgenai# The client gets the API key from the environment variable `GEMINI_API_KEY`.client=genai.Client()response=client.models.generate_content(# model="gemini-2.5-flash", contents="2025年中国发生了哪些重要事情"model="gemini-3-flash-preview",contents="2025年中国发生了哪些重要事情")print(response.text)