Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

2.4.0

Compare
Choose a tag to compare
@dsdanielpark dsdanielpark released this 26 Mar 08:48
· 118 commits to main since this release
79b9211

Gemini Icon Gemini-API v2.4.0

This release includes various bug fixes and new features.

What's changed?

  • Adding temporary free access to open-source LLM APIs. Stably use Google's Gemma for free.
  • [Example codes] (Free limit: 10 requests/minute)

Installation 📦

pip install python-gemini-api==2.4.0

Utilize free open-source LLM API through Open Router in Gemini-API

OpenRouter offers temporary free inference for select models. Obtain an API key from Open Router API and check free models at Open Router models. Use models with a 0-dollar token cost primarily; other models may incur charges. See more free open-source LLM API guide

from gemini import OpenRouter

OPENROUTER_API_KEY = "<your_open_router_api_key>"
GemmaClient = OpenRouter(api_key=OPENROUTER_API_KEY, model="google/gemma-7b-it:free")

prompt = "Do you know UCA academy in Korea? https://blog.naver.com/ulsancoding"
response = GemmaClient.create_chat_completion(prompt)
print(response)

# payload = GemmaClient.generate_content(prompt)
# print(payload.json())

The free model list includes:

Note

You can easily receive responses from open LLMs without this package by following the instructions on here.