Thin wrapper for OpenRouter chat completions API
Project description
PrabhatAI
A thin Python wrapper for the OpenRouter chat completions API.
Installation
pip install prabhatai
Usage
1. Install locally
Navigate to the PrabhatAI directory and run:
pip install .
2. Use in your Python code
By default, the package uses the included API key and the free DeepSeek model, with a safe default for max_tokens.
from prabhatai.client import PrabhatAIClient
client = PrabhatAIClient() # Uses default API key and model
response = client.chat([
{"role": "user", "content": "Hello!"}
])
print(response)
To use your own API key
Set the environment variable:
export OPENROUTER_API_KEY="sk-or-...your-key..."
Or pass it directly:
client = PrabhatAIClient(api_key="sk-or-...your-key...")
To use a different model or max_tokens
response = client.chat([
{"role": "user", "content": "Hello!"}
], model="openai/gpt-4o", max_tokens=500)
The default max_tokens is set to 1000 to avoid quota errors for free accounts.
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 prabhatai-0.1.0.tar.gz.
File metadata
- Download URL: prabhatai-0.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1392a55bcd9cde212da27bd16c505ffa388700b1da993b7dca42e2b7d405401
|
|
| MD5 |
3211d7a48e6083720d8b1741ac16bdfa
|
|
| BLAKE2b-256 |
984d0448dbeed19244815159bc6708499bc83c5a6605bd6814870effe6e5773a
|
File details
Details for the file prabhatai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: prabhatai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1de10ce80f80bdf4d3d979b5be34232d429fb5cf121579cebd89a9d2acc0aeb8
|
|
| MD5 |
5be466d4694749b75657a10b332df2bc
|
|
| BLAKE2b-256 |
f1da720a2a2d84698c5174a8f6765d591a5af938f1a48b830bc0a484117517d6
|