NoLimitAI
NoLimitAI is a Python library designated to route LLM requests across multiple providers (Groq, OpenRouter, Together AI, Gemini, Mistral) with built-in round-robin load balancing and automatic failover. It simplifies managing multiple AI services through a single, unified asynchronous API.
Features
- Multi-Provider Support: Seamlessly switch between Groq, OpenRouter, Together AI, Google Gemini, and Mistral AI.
- Round-Robin & Fallback: Automatically rotates through configured providers to distribute load and handles failures by retrying with the next available service.
- Async Streaming: Native
async/awaitsupport with streaming responses. - Unified Interface: Use one standard API for all providers.
Installation
Install the package from PyPI:
pip install nolimit-ai
You can view the project on PyPI here: https://pypi.org/project/nolimitai/
Usage
Here is a complete example of how to configure and use NoLimitAI.
1. Basic Setup
You need to provide API keys for the services you want to use. The library does not automatically load environment variables; you must pass them explicitly.
import asyncio
import os
from nolimitai import NolimitAI
# Optional: Load environment variables from a .env file
# from dotenv import load_dotenv
# load_dotenv()
async def main():
# Initialize the client
nlai = NolimitAI()
# Configure the client with your API keys and optional parameters
# You only need to provide keys for the services you intend to use.
nlai.set_config(
temperature=0.7,
max_tokens=1024,
top_p=0.9,
keys={
"groq": os.getenv("GROQ_API_KEY"),
"openrouter": os.getenv("OPENROUTER_API_KEY"),
"gemini_ai": os.getenv("GEMINI_API_KEY"),
"mistral_ai": os.getenv("MISTRAL_API_KEY"),
"together_ai": os.getenv("TOGETHER_API_KEY"),
}
)
prompt = "Explain the concept of round-robin scheduling in one sentence."
print(f"--- Asking: {prompt} ---\n")
# Check which service is next in line (optional)
next_service = nlai.get_next_service()
print(f"[Next Service]: {next_service}")
try:
# Stream the response
print("[Response]: ", end="", flush=True)
async for token in nlai.chat(prompt=prompt):
print(token, end="", flush=True)
print("\n")
# Check which service actually handled the request
used_service = nlai.get_last_used_service()
print(f"[Used Service]: {used_service}")
except Exception as e:
print(f"\nAn error occurred: {e}")
if __name__ == "__main__":
asyncio.run(main())
2. Configuration Options
The set_config method accepts the following parameters:
temperature(float): Sampling temperature (0.0 to 1.0).max_tokens(int): Maximum number of tokens to generate.top_p(float): Nucleus sampling parameter.keys(dict): A dictionary mapping provider names to API keys.
Supported Keys:
"groq""openrouter""together_ai""gemini_ai""mistral_ai"
Important Notes
- Failover: If a service fails to connect or authorize, the router will automatically try the next configured service in the list.
Troubleshooting
RuntimeError: NoLimitIA no ha sido configurado: This error occurs if you try to callchat()before callingset_config(). Ensure you configure the instance with at least one valid API key.- Authentication Errors: Ensure your API keys are correct. If a key is invalid, the router will treat it as a failure and attempt to switch to another provider if available.
License
This project is licensed under the Apache-2.0 License.
Metadata
Release files for nolimit-ai 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| nolimit_ai-0.1.1.tar.gz | 17.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nolimit_ai-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.6 kB
Release files / nolimit_ai-0.1.1.tar.gz
| Download URL | nolimit_ai-0.1.1.tar.gz |
|---|---|
| Size | 17.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5788baab66627192ab14c57e3530669d54d3a4d72d30cd2748f703f723d79606
|
|
BLAKE2b-256 checksum How to use checksums |
3fb137b0b074b226bd68990495c34515277b880ee2ac45781f871aedd2aae882
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / nolimit_ai-0.1.1-py3-none-any.whl
| Download URL | nolimit_ai-0.1.1-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba71b62f119ab9d58a003b63e03f527e70cb79d85edd0ea0c49f918db06eb843
|
|
BLAKE2b-256 checksum How to use checksums |
93ae457a87ea2d6737d27dac3cdf8d58fcd4aa71a2146713c204994ebe21f257
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for nolimit-ai 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.