Installation

This guide will help you install and configure the Maniac Python library.

Prerequisites

  • Python 3.9 or higher

  • Maniac API key (provides access to all model providers automatically)

Installation

Install the Maniac library using pip:

pip install maniac

Setup

1. Get Your Maniac API Key

Sign up at maniac.ai to get your API key that provides access to all supported models.

2. Configure Authentication

Set your API key via environment variable:

export MANIAC_API_KEY=your-maniac-api-key

3. Test Installation

from maniac import Maniac

client = Maniac(api_key="your-maniac-api-key")

# Test with any model - Maniac handles provider routing
response = client.chat.completions.create(
    fallback="claude-opus-4",
    messages=[{"role": "user", "content": "Hello!"}],
    task_label="installation-test",
    judge_prompt="Compare two greeting responses. Is A better than B? Consider: friendliness, appropriateness."
)

print(response["choices"][0]["message"]["content"])

Verify Installation

Check that Maniac is installed correctly:

import maniac
print(f"Maniac version: {maniac.__version__}")
print("Available components:", maniac.__all__)

Optional Dependencies

For Advanced Features

# For async support
pip install maniac-ai[async]

# For data processing utilities
pip install maniac-ai[data]

# For local model support
pip install maniac-ai[local]

# Install all optional dependencies
pip install maniac-ai[all]

Environment Setup

Setting API Keys

You can set your API key in several ways:

Environment Variable (Recommended)

export MANIAC_API_KEY="your-api-key-here"

Configuration File Create ~/.maniac/config.yaml:

api_key: your-api-key-here
environment: production
region: us-west-2

In Code

client = Maniac(api_key="your-maniac-api-key")

Simple Configuration

from maniac import Maniac

# Simple initialization - all optimization handled automatically
client = Maniac(api_key="your-maniac-api-key")

Upgrading

Upgrade to Latest Version

pip install --upgrade maniac-ai

Check for Updates

from maniac import check_for_updates

if check_for_updates():
    print("New version available! Run: pip install --upgrade maniac-ai")

Migration Guides

Platform Support

Supported Python Versions

  • Python 3.8

  • Python 3.9

  • Python 3.10

  • Python 3.11

  • Python 3.12

Operating Systems

  • Linux (Ubuntu 20.04+, CentOS 8+, Debian 10+)

  • macOS (10.15+)

  • Windows (10, 11, Server 2019+)

Cloud Platforms

  • AWS Lambda

  • Google Cloud Functions

  • Azure Functions

  • Vercel

  • Heroku

Troubleshooting Installation

Common Issues

SSL Certificate Error

pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org maniac-ai

Permission Denied

pip install --user maniac-ai

Dependency Conflicts

# Create a virtual environment
python -m venv maniac-env
source maniac-env/bin/activate  # On Windows: maniac-env\Scripts\activate
pip install maniac-ai

Behind Corporate Proxy

pip install --proxy http://user:[email protected]:port maniac-ai

Uninstallation

To completely remove Maniac:

# Remove package
pip uninstall maniac-ai

# Remove configuration files (optional)
rm -rf ~/.maniac

# Remove cache (optional)
rm -rf ~/.cache/maniac

Next Steps

Last updated