Skip to main content

A zen, simple, and unified API to prompt LLMs from Anthropic, Google, OpenAI, and more, using only the requests library.

Project description

🧘‍♂️ ZenLLM

PyPI version License: MIT Python 3.8+

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 requests and 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 model argument.
  • Lightweight: Built with only the requests library. 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 (Anthropic's Claude)

from zenllm import prompt

# The default model is from Anthropic
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
Google 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zenllm-0.1.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zenllm-0.1.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file zenllm-0.1.1.tar.gz.

File metadata

  • Download URL: zenllm-0.1.1.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for zenllm-0.1.1.tar.gz
Algorithm Hash digest
SHA256 13f851b0b04bc2eee61be8915af7f0b0822b5551d8ab575486b1cba8f6c4d41d
MD5 06b7d80ea2c2c7874cb2938485ea3fb8
BLAKE2b-256 ac623e76d0c1bfa96403723c0a1699018d9188696d05a10e6d4831673fcc09dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for zenllm-0.1.1.tar.gz:

Publisher: publish_to_pypi.yml on koenvaneijk/zenllm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zenllm-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: zenllm-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for zenllm-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 03c9f06b3e4ddb06ab97376e85847de88753c4de6addb190b6b8287aabad7492
MD5 481b8d4b81fa6f58304b2459fb88fa26
BLAKE2b-256 ddb0efaab36e240ccfc5f75d8697a2b714f2193d7fdd7335c9f06bc1ea595890

See more details on using hashes here.

Provenance

The following attestation bundles were made for zenllm-0.1.1-py3-none-any.whl:

Publisher: publish_to_pypi.yml on koenvaneijk/zenllm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page