Skip to main content

azllm: A Unified LLM Interface for Multi-Provider Access

PyPI version DOI Python

azllm is a Python package that provides a unified interface to work with multiple LLM providers including OpenAI, DeepSeek, Grok, Gemini, Meta's LLaMA, Anthropic, Ollama, and more.

NOTE: For advanced usage, see the azllm documentation and/or examples.


Features

  • One unified interface for all major LLM APIs
  • Batch and parallel prompt generation
  • Structured outputs (parsing) with Pydantic for models that support parsed outputs natively
  • Structured outputs (parsing) with Pydantic for DeepSeek and Anthropic
  • Per-model configurations and lazy initialization
  • Clean error handling
  • .env-based API key management

Supported Clients

NOTE: If you would like to request support for additional LLMs, please open an issue on our GitHub page.

Installation

You can install the azllm package via pip:

pip install azllm

Prerequisites

  • Python 3.11+

  • Create a .env file to store your API keys. For example:

    OPENAI_API_KEY=your_openai_api_key
    DEEPSEEK_API_KEY=your_deepseek_api_key
    XAI_API_KEY=your_xai_api_key
    GEMINI_API_KEY=your_gemini_api_key
    ANTHROPIC_API_KEY=your_anthropic_api_key
    FIREWORKS_API_KEY=your_fireworks_api_key
    
  • Ollama must be installed and running locally to use Ollama models.

Quick Start

Basic Initialization

from azllm import azLLM
manager = azLLM()  # Instantiated with default parameters 

Generate Text from a Single Prompt

prompt = 'What is the captial of France?'
generated_text = manager.generate_text('openai', prompt)
print(generated_text)

Batch Generation

Generate responses for multiple prompts at once:

batch_prompts = [
    'What is the capital of France?',
    'Tell me a joke.'
    ]

results = manager.batch_generate('openai', batch_prompts)
for result in results:
    print(result)

Parallel Generation

Run a single prompt across multiple models simultaneously:

prompt = 'What is the capital of France?'
models = [
    'openai',
    'grok',
    'ollama']

results = manager.generate_parallel(prompt, models)
for model, result in results.items():
    print(f"Model: {model},\nResult: {result}\n")

License

MIT License

Citation

@misc{azLLM,
  title        = {azllm},
  author       = {Hanif Sajid and Benjamin Radford and Yaoyao Dai and Jason Windett},
  year         = {2025},
  month        = apr,
  version      = {0.1.6},
  howpublished = {https://github.com/hanifsajid/azllm},
  note         = {MIT License},
  abstract     = {azllm is a Python package designed to interface with various large language models (LLMs) from different AI providers. It offers a unified interface for interacting with models from providers like OpenAI, DeepSeek, Grok, Gemini, Meta's Llama, Anthropic, Ollama, and others. The package allows for customizable configurations, batch generation, parallel generation, error handling, and the ability to parse structured responses from different models.}
}

Release files for azllm 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for azllm 0.1.6
File Size Uploaded
azllm-0.1.6.tar.gz 15.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for azllm 0.1.6
File Interpreter ABI Platform
azllm-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 43.3 kB

Release files / azllm-0.1.6.tar.gz

Download URL azllm-0.1.6.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
acca4a9ae78d575bdda47d0e0842b107cf7e39141aad687ba34087ee9e7bbd09
BLAKE2b-256 checksum
How to use checksums
767709e6325f16753f89d9db5f56a7f315df2d209f54b6e47046fb2b159e83ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.11.13 Linux/6.11.0-1018-azure

Release files / azllm-0.1.6-py3-none-any.whl

Download URL azllm-0.1.6-py3-none-any.whl
Size 27.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb7febfa4c7956a9607693776612f025d90a718bb9f5f72c0dbbd82b253d9fe5
BLAKE2b-256 checksum
How to use checksums
87cf8fc05a50f5424c5217e9ee74c937e913fe748aea31631b4fe476fb84822d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.11.13 Linux/6.11.0-1018-azure

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page