Lightweight unified multi-LLM API gateway.
Unify OpenAI and Gemini interface, one set of code calls all mainstream large models.
- Unified request format, compatible with OpenAI standard SDK
- Support local rapid deployment, zero complex configuration
- Low resource consumption, suitable for backend service integration
pip install openai google-generativeai# Mac / Linux
export OPENAI_API_KEY=your_key_here
export GEMINI_API_KEY=your_key_here
# Windows CMD
set OPENAI_API_KEY=your_key_here
set GEMINI_API_KEY=your_key_herefrom unified_llm_client import UnifiedLLMClient
client = UnifiedLLMClient()
# Call OpenAI GPT
gpt_res = client.chat("gpt-4o", "your question")
print(gpt_res)
# Call Google Gemini
gem_res = client.chat("gemini-1.5-flash", "your question")
print(gem_res)model_name: Specify target LLM modelprompt: Input query for model generationReturn: Raw text output from LLM
gpt-4ogpt-4-turbogpt-3.5-turbo
gemini-1.5-flashgemini-1.5-pro