A zen, simple, and unified API to prompt LLMs from Anthropic, Google, OpenAI, and more, using only the requests library.
Project description
🧘♂️ ZenLLM
The zen, simple, and unified API to prompt LLMs from different providers using a single function call.
Our Goal: No fancy dependencies, no SDK bloat. Just
requestsand your API keys. Easily switch between models and providers without changing your code.
✨ Key Features
- Unified API: A single
prompt()function for Anthropic, Google, and OpenAI. - Easy Model Switching: Change models and providers with a single
modelargument. - Lightweight: Built with only the
requestslibrary. No heavy SDKs to install. - Simple Authentication: Just set your provider's API key as an environment variable.
🚀 Installation
pip install zenllm
💡 Usage
First, make sure you've set your API key as an environment variable (e.g., export ANTHROPIC_API_KEY="your-key").
Basic Prompt
The default model is claude-sonnet-4-20250514. You can change this by setting the ZENLLM_DEFAULT_MODEL environment variable.
from zenllm import prompt
# Uses the default model (either the fallback or ZENLLM_DEFAULT_MODEL)
response = prompt("Why is the sky blue?")
print(response)
Using another Provider (Google's Gemini)
Simply change the model name to use a different provider.
from zenllm import prompt
response = prompt(
"Why is the sky blue?",
model="gemini-2.5-pro",
system_prompt="Reply only in French."
)
print(response)
Using OpenAI
from zenllm import prompt
response = prompt(
"Tell me a three sentence bedtime story about a unicorn.",
model="gpt-4.1"
)
print(response)
Streaming Responses
Set stream=True to get a generator of response chunks.
from zenllm import prompt
response_stream = prompt(
"Tell me a story about a robot.",
model="claude-sonnet-4-20250514",
stream=True
)
for chunk in response_stream:
print(chunk, end="", flush=True)
✅ Supported Providers
| Provider | Environment Variable | Model Prefix | Example Models |
|---|---|---|---|
| Anthropic | ANTHROPIC_API_KEY |
claude |
claude-sonnet-4-20250514, claude-opus-4-20250514 |
| Deepseek | DEEPSEEK_API_KEY |
deepseek |
deepseek-chat, deepseek-reasoner |
GEMINI_API_KEY |
gemini |
gemini-2.5-pro, gemini-2.5-flash |
|
| OpenAI | OPENAI_API_KEY |
gpt |
gpt-4.1 |
Note: Streaming is not yet supported for OpenAI with this library.
📜 License
MIT License - Copyright (c) 2025 Koen van Eijk
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 zenllm-0.1.2.tar.gz.
File metadata
- Download URL: zenllm-0.1.2.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46a31ff2689af409d6e5e860a8359cb5fc7fe682a925a305d9793719be1351f9
|
|
| MD5 |
faf03d0896445d89b1be19a46f4af584
|
|
| BLAKE2b-256 |
77b181cb695e08a0ee9e740bc61f5cd7f006a84c1e5b4ef40d5e1be354633a74
|
Provenance
The following attestation bundles were made for zenllm-0.1.2.tar.gz:
Publisher:
publish_to_pypi.yml on koenvaneijk/zenllm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zenllm-0.1.2.tar.gz -
Subject digest:
46a31ff2689af409d6e5e860a8359cb5fc7fe682a925a305d9793719be1351f9 - Sigstore transparency entry: 248309957
- Sigstore integration time:
-
Permalink:
koenvaneijk/zenllm@ca27dc9722930a90abe1ebf747cf04bfce4e20c3 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/koenvaneijk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_to_pypi.yml@ca27dc9722930a90abe1ebf747cf04bfce4e20c3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file zenllm-0.1.2-py3-none-any.whl.
File metadata
- Download URL: zenllm-0.1.2-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4863add606c00f6ffbc3f11e50fad91f3ae8bd5c919aac34cdd1db81db390b22
|
|
| MD5 |
e1e2cabbedfeaed04bd68832263a5659
|
|
| BLAKE2b-256 |
ed5d3a84eaf5dc7cab25da0bad6f166766ddc683da130736020d266628125136
|
Provenance
The following attestation bundles were made for zenllm-0.1.2-py3-none-any.whl:
Publisher:
publish_to_pypi.yml on koenvaneijk/zenllm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zenllm-0.1.2-py3-none-any.whl -
Subject digest:
4863add606c00f6ffbc3f11e50fad91f3ae8bd5c919aac34cdd1db81db390b22 - Sigstore transparency entry: 248309961
- Sigstore integration time:
-
Permalink:
koenvaneijk/zenllm@ca27dc9722930a90abe1ebf747cf04bfce4e20c3 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/koenvaneijk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_to_pypi.yml@ca27dc9722930a90abe1ebf747cf04bfce4e20c3 -
Trigger Event:
release
-
Statement type: