A package for managing multiple LLM providers with automatic key shifting to bypass rate limits and quotas while maintaining conversation context.
Project description
APIShift
Overview
APIShift is a Python package that enables seamless interaction with multiple free-tier language model (LLM) providers.
Installation
pip install APIShift
Quick Start
from APIShift import Conversation
from APIShift import GeminiProvider, OpenRouterProvider
# Initialize providers with API keys
gemini_keys = ['your_gemini_api_key1', 'your_gemini_api_key2']
openrouter_keys = ['your_openrouter_api_key1', 'your_openrouter_api_key2']
# Create a conversation with multiple providers
conversation = Conversation([
GeminiProvider(gemini_keys),
OpenRouterProvider(openrouter_keys)
])
# Send messages
response = conversation.send_message("Hello, how are you?")
print(response)
Using FAISS for Context Retrieval
APIShift now supports using FAISS for context retrieval. This allows you to add messages to a FAISS index and retrieve contextually relevant messages during a conversation.
Example
from APIShift import Conversation
from APIShift import GeminiProvider, OpenRouterProvider
# Initialize providers with API keys
gemini_keys = ['your_gemini_api_key1', 'your_gemini_api_key2']
openrouter_keys = ['your_openrouter_api_key1', 'your_openrouter_api_key2']
# Create a conversation with multiple providers
conversation = Conversation([
GeminiProvider(gemini_keys),
OpenRouterProvider(openrouter_keys)
])
# Add messages to FAISS index
conversation.add_to_faiss("Hello, how are you?")
conversation.add_to_faiss("What is the weather like today?")
# Send messages and retrieve context
response = conversation.send_message("Tell me about the weather.")
print(response)
More details coming soon...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file apishift-1.0.1.tar.gz.
File metadata
- Download URL: apishift-1.0.1.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
509f7cc7bf8ad8f73f53e0dd7578de8db2feb058d5810ddf6c7aa95963f00c3e
|
|
| MD5 |
b76054c1505b15ece51ac62164b50303
|
|
| BLAKE2b-256 |
d76887d63e64d1d17fffa530d3e55f8550e8b3000d99cec07a0abfc08ea449e1
|
File details
Details for the file apishift-1.0.1-py3-none-any.whl.
File metadata
- Download URL: apishift-1.0.1-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51a0446defc7d3a77c32769ed6e2ac2e1e2c78f1774a647370b1adfa466bbce4
|
|
| MD5 |
7a9f4179603207ebf568486f7b2bf09e
|
|
| BLAKE2b-256 |
b0e1a6977877f71ec9b5a8abad22d6dcc98be20dbcf17748448faece2e230175
|