Skip to main content

groq-gemini-bridge

Chatbot library for Groq and Gemini. Give it multiple API keys; when one hits its rate limit it automatically switches to the next.

Install

pip install groq-gemini-bridge

Setup

Set environment variables (comma-separated keys):

export GROQ_API_KEYS="groq_key_1,groq_key_2"
export GEMINI_API_KEYS="gemini_key_1,gemini_key_2"

Use in code

from groq_gemini_bridge import Chatbot, build_providers

bot = Chatbot(build_providers(), system_prompt="You are a helpful assistant.")
result = bot.ask("What is Python?")
print(result["provider"], result["reply"])   # e.g. groq-1 ...

bot.ask("Explain more")                      # remembers the conversation
bot.ask("Hi", provider="gemini")             # prefer a provider ("gemini") or one key ("groq-2")
bot.reset()                                  # clear history

Terminal chat

pip install "groq-gemini-bridge[cli]"
groq-gemini-chat

How failover works

Order: groq-1 -> groq-2 -> gemini-1 -> gemini-2. A key that returns HTTP 429 is skipped for 60s (or the Retry-After time). If all keys fail, LLMError is raised.

REST API example

See examples/fastapi_app.py (pip install "groq-gemini-bridge[api]").

Metadata

Release files for groq-gemini-bridge 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for groq-gemini-bridge 0.1.0
File Size Uploaded
groq_gemini_bridge-0.1.0.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for groq-gemini-bridge 0.1.0
File Interpreter ABI Platform
groq_gemini_bridge-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.0 kB

Release files / groq_gemini_bridge-0.1.0.tar.gz

Download URL groq_gemini_bridge-0.1.0.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
514c1b95908c608ebb1f03d8d965bd1c50c257a0e088d5a6a64b71335c725b7c
BLAKE2b-256 checksum
How to use checksums
19cac7834d252369968ced252d3dfd1da058f74d18c7e1026f2bce11608fb6db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.10

Release files / groq_gemini_bridge-0.1.0-py3-none-any.whl

Download URL groq_gemini_bridge-0.1.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
341b8b70b3b6c8a5bd932a868da42774e7c2c975f66f73f62080bbfd06516a43
BLAKE2b-256 checksum
How to use checksums
612e3259485a5c4200303aa52163b2d783f8d47e4e0dd189c53896e0ac7e3431
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.10

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page