llm-anygate


Namellm-anygate JSON
Version 1.0.4 PyPI version JSON
download
home_pageNone
SummaryA flexible gateway for connecting and managing multiple LLM providers
upload_time2025-08-27 15:40:31
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseMIT License Copyright (c) 2024 igamenovoer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords ai anthropic api gateway llm openai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # LLM AnyGate

[![Python Version](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
[![Documentation](https://img.shields.io/badge/docs-mkdocs-blue)](https://igamenovoer.github.io/llm-anygate/)

A powerful CLI tool that generates LiteLLM proxy projects from simple YAML configurations. Designed to free users from understanding the complexities of the LiteLLM library and quickly create local LLM proxies for use with various AI coding tools.

## Overview

LLM AnyGate simplifies the process of setting up LiteLLM proxy servers by providing a simple command-line interface to generate complete, ready-to-run proxy projects with minimal configuration.

## Key Features

🚀 **Quick Setup** - Create a fully configured LiteLLM proxy project with one command  
📝 **Simple Configuration** - Use minimal YAML config instead of complex LiteLLM settings (or use defaults)  
🔧 **Zero Database** - Generated proxies run statelessly without database requirements  
🖥️ **Cross-Platform** - Works on Windows, macOS, and Linux with unified CLI commands  
🎯 **Production Ready** - Generates complete project with config, environment templates, and documentation  
📦 **PyPI Package** - Easy installation via pip from official PyPI repository

## Prerequisites

- **Python 3.11 or higher**
- **LiteLLM CLI tool** (for running generated proxies)
  ```bash
  # Recommended: Install using uv
  uv tool install 'litellm[proxy]'
  
  # Alternative: Install with pip
  pip install 'litellm[proxy]'
  ```

## Installation

### From PyPI

```bash
pip install llm-anygate
```

### For Development (with Pixi)

```bash
# Clone the repository
git clone https://github.com/igamenovoer/llm-anygate.git
cd llm-anygate

# Initialize submodules
git submodule update --init --recursive

# Setup development environment with Pixi
pixi install
pixi shell
```

## Quick Start

### Step 1: Generate Proxy Project (Optional Configuration)

Use the CLI to generate a complete LiteLLM proxy project. The model configuration is optional:

```bash
# With default configuration (uses gpt-4o with OPENAI_API_KEY)
llm-anygate-cli create --project my-proxy

# With custom configuration file
llm-anygate-cli create \
  --project my-proxy \
  --model-config model-config.yaml \
  --port 4567 \
  --master-key "sk-my-secure-key"
```

If you want to use a custom model configuration, create a YAML file (`model-config.yaml`):

```yaml
model_list:                                # Array of available models for the proxy
  - model_name: gpt-4o                     # Alias name that clients use to request this model
    litellm_params:                        # LiteLLM-specific parameters for this model
      model: openai/gpt-4o                 # Provider prefix + actual model ID
      api_base: https://api.openai.com/v1  # API endpoint URL (optional for OpenAI)
      api_key: os.environ/OPENAI_API_KEY   # References environment variable

  - model_name: claude-3-5-sonnet          # Alias for Anthropic Claude model
    litellm_params:
      model: anthropic/claude-3-5-sonnet-20241022  # Anthropic provider + model version
      api_key: os.environ/ANTHROPIC_API_KEY        # Environment variable reference
      
  - model_name: gemini-pro                 # Alias for Google Gemini model
    litellm_params:
      model: gemini/gemini-pro             # Google provider + model name
      api_key: os.environ/GEMINI_API_KEY   # Environment variable reference
```

### Step 2: Configure Environment

```bash
cd my-proxy

# Copy and configure environment variables
cp env.example .env
# Edit .env and add your API keys
```

### Step 3: Start the Proxy Server

```bash
# Start specifying the project directory
llm-anygate-cli start --project my-proxy

# Or start from within the project directory
cd my-proxy
llm-anygate-cli start
```

### Step 4: Use the Proxy

Your proxy is now running at `http://localhost:4567` with an OpenAI-compatible API:

```python
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:4567/v1",
    api_key="sk-my-secure-key"
)

response = client.chat.completions.create(
    model="gpt-4o",  # or any model from your config
    messages=[{"role": "user", "content": "Hello!"}]
)
```

## Generated Project Structure

The CLI generates a complete project with:

```
my-proxy/
├── config.yaml         # Full LiteLLM configuration
├── env.example         # Template for API keys
├── anygate.yaml       # Project configuration for llm-anygate-cli
└── README.md          # Project documentation
```

## CLI Usage

### Create Command

```bash
llm-anygate-cli create [options]
```

**Options:**
- `--project <dir>` (required) - Directory to create the project in
- `--model-config <file>` (optional) - Path to your model configuration YAML (generates default gpt-4o config if not provided)
- `--port <number>` - Port for the proxy server (default: 4567)
- `--master-key <key>` - Master key for API authentication (default: sk-dummy)

### Start Command

```bash
llm-anygate-cli start [options]
```

**Options:**
- `--project <dir>` (optional) - Project directory (default: current directory)
- `--port <number>` (optional) - Override port from project configuration
- `--master-key <key>` (optional) - Override master key from project configuration

The start command reads configuration from `anygate.yaml` in the project directory.

### Examples

```bash
# Create with default configuration
llm-anygate-cli create --project my-proxy

# Create with custom configuration
llm-anygate-cli create \
  --project /path/to/my-llm-proxy \
  --model-config configs/models.yaml \
  --port 8080 \
  --master-key "sk-production-key-here"

# Start proxy from project directory
cd my-proxy
llm-anygate-cli start

# Start proxy with overrides
llm-anygate-cli start --port 3000 --master-key "sk-new-key"
```

## Model Configuration Format

The model configuration is a simple YAML file with a `model_list` array:

```yaml
model_list:
  - model_name: <name-for-your-app>
    litellm_params:
      model: <provider>/<model-id>
      api_base: <api-endpoint>  # Optional
      api_key: os.environ/<ENV_VAR_NAME>
      # Additional parameters as needed
```

### Supported Providers

- OpenAI and OpenAI-compatible endpoints
- Anthropic (Claude)
- Google (Gemini/Vertex)
- Azure OpenAI
- Local models (Ollama, etc.)
- Any provider supported by LiteLLM

## Security Notes

- Generated projects include `env.example` as a template for API keys
- Never commit `.env` files with actual API keys
- Always use secure master keys in production

## Contributing

Contributions are welcome! Please see our [Contributing Guide](docs/development/contributing.md) for details.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Acknowledgments

- Built with [OmegaConf](https://github.com/omry/omegaconf) for robust configuration handling
- Uses [Pixi](https://pixi.sh/) for environment management
- Generates configurations for [LiteLLM](https://github.com/BerriAI/litellm)
- Project structure based on [magic-context](https://github.com/igamenovoer/magic-context) templates

## Contact

- GitHub: [@igamenovoer](https://github.com/igamenovoer)
- Issues: [GitHub Issues](https://github.com/igamenovoer/llm-anygate/issues)

## Support

For questions, issues, or feature requests, please open an issue on GitHub.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llm-anygate",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "ai, anthropic, api, gateway, llm, openai",
    "author": null,
    "author_email": "igamenovoer <igamenovoer@github.com>",
    "download_url": "https://files.pythonhosted.org/packages/8f/65/f96f96bbb0cdc2c4fdc5fbfa6e017f5fc5d65c5b28fe79494caade21bf16/llm_anygate-1.0.4.tar.gz",
    "platform": null,
    "description": "# LLM AnyGate\n\n[![Python Version](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org/downloads/)\n[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)\n[![Documentation](https://img.shields.io/badge/docs-mkdocs-blue)](https://igamenovoer.github.io/llm-anygate/)\n\nA powerful CLI tool that generates LiteLLM proxy projects from simple YAML configurations. Designed to free users from understanding the complexities of the LiteLLM library and quickly create local LLM proxies for use with various AI coding tools.\n\n## Overview\n\nLLM AnyGate simplifies the process of setting up LiteLLM proxy servers by providing a simple command-line interface to generate complete, ready-to-run proxy projects with minimal configuration.\n\n## Key Features\n\n\ud83d\ude80 **Quick Setup** - Create a fully configured LiteLLM proxy project with one command  \n\ud83d\udcdd **Simple Configuration** - Use minimal YAML config instead of complex LiteLLM settings (or use defaults)  \n\ud83d\udd27 **Zero Database** - Generated proxies run statelessly without database requirements  \n\ud83d\udda5\ufe0f **Cross-Platform** - Works on Windows, macOS, and Linux with unified CLI commands  \n\ud83c\udfaf **Production Ready** - Generates complete project with config, environment templates, and documentation  \n\ud83d\udce6 **PyPI Package** - Easy installation via pip from official PyPI repository\n\n## Prerequisites\n\n- **Python 3.11 or higher**\n- **LiteLLM CLI tool** (for running generated proxies)\n  ```bash\n  # Recommended: Install using uv\n  uv tool install 'litellm[proxy]'\n  \n  # Alternative: Install with pip\n  pip install 'litellm[proxy]'\n  ```\n\n## Installation\n\n### From PyPI\n\n```bash\npip install llm-anygate\n```\n\n### For Development (with Pixi)\n\n```bash\n# Clone the repository\ngit clone https://github.com/igamenovoer/llm-anygate.git\ncd llm-anygate\n\n# Initialize submodules\ngit submodule update --init --recursive\n\n# Setup development environment with Pixi\npixi install\npixi shell\n```\n\n## Quick Start\n\n### Step 1: Generate Proxy Project (Optional Configuration)\n\nUse the CLI to generate a complete LiteLLM proxy project. The model configuration is optional:\n\n```bash\n# With default configuration (uses gpt-4o with OPENAI_API_KEY)\nllm-anygate-cli create --project my-proxy\n\n# With custom configuration file\nllm-anygate-cli create \\\n  --project my-proxy \\\n  --model-config model-config.yaml \\\n  --port 4567 \\\n  --master-key \"sk-my-secure-key\"\n```\n\nIf you want to use a custom model configuration, create a YAML file (`model-config.yaml`):\n\n```yaml\nmodel_list:                                # Array of available models for the proxy\n  - model_name: gpt-4o                     # Alias name that clients use to request this model\n    litellm_params:                        # LiteLLM-specific parameters for this model\n      model: openai/gpt-4o                 # Provider prefix + actual model ID\n      api_base: https://api.openai.com/v1  # API endpoint URL (optional for OpenAI)\n      api_key: os.environ/OPENAI_API_KEY   # References environment variable\n\n  - model_name: claude-3-5-sonnet          # Alias for Anthropic Claude model\n    litellm_params:\n      model: anthropic/claude-3-5-sonnet-20241022  # Anthropic provider + model version\n      api_key: os.environ/ANTHROPIC_API_KEY        # Environment variable reference\n      \n  - model_name: gemini-pro                 # Alias for Google Gemini model\n    litellm_params:\n      model: gemini/gemini-pro             # Google provider + model name\n      api_key: os.environ/GEMINI_API_KEY   # Environment variable reference\n```\n\n### Step 2: Configure Environment\n\n```bash\ncd my-proxy\n\n# Copy and configure environment variables\ncp env.example .env\n# Edit .env and add your API keys\n```\n\n### Step 3: Start the Proxy Server\n\n```bash\n# Start specifying the project directory\nllm-anygate-cli start --project my-proxy\n\n# Or start from within the project directory\ncd my-proxy\nllm-anygate-cli start\n```\n\n### Step 4: Use the Proxy\n\nYour proxy is now running at `http://localhost:4567` with an OpenAI-compatible API:\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"http://localhost:4567/v1\",\n    api_key=\"sk-my-secure-key\"\n)\n\nresponse = client.chat.completions.create(\n    model=\"gpt-4o\",  # or any model from your config\n    messages=[{\"role\": \"user\", \"content\": \"Hello!\"}]\n)\n```\n\n## Generated Project Structure\n\nThe CLI generates a complete project with:\n\n```\nmy-proxy/\n\u251c\u2500\u2500 config.yaml         # Full LiteLLM configuration\n\u251c\u2500\u2500 env.example         # Template for API keys\n\u251c\u2500\u2500 anygate.yaml       # Project configuration for llm-anygate-cli\n\u2514\u2500\u2500 README.md          # Project documentation\n```\n\n## CLI Usage\n\n### Create Command\n\n```bash\nllm-anygate-cli create [options]\n```\n\n**Options:**\n- `--project <dir>` (required) - Directory to create the project in\n- `--model-config <file>` (optional) - Path to your model configuration YAML (generates default gpt-4o config if not provided)\n- `--port <number>` - Port for the proxy server (default: 4567)\n- `--master-key <key>` - Master key for API authentication (default: sk-dummy)\n\n### Start Command\n\n```bash\nllm-anygate-cli start [options]\n```\n\n**Options:**\n- `--project <dir>` (optional) - Project directory (default: current directory)\n- `--port <number>` (optional) - Override port from project configuration\n- `--master-key <key>` (optional) - Override master key from project configuration\n\nThe start command reads configuration from `anygate.yaml` in the project directory.\n\n### Examples\n\n```bash\n# Create with default configuration\nllm-anygate-cli create --project my-proxy\n\n# Create with custom configuration\nllm-anygate-cli create \\\n  --project /path/to/my-llm-proxy \\\n  --model-config configs/models.yaml \\\n  --port 8080 \\\n  --master-key \"sk-production-key-here\"\n\n# Start proxy from project directory\ncd my-proxy\nllm-anygate-cli start\n\n# Start proxy with overrides\nllm-anygate-cli start --port 3000 --master-key \"sk-new-key\"\n```\n\n## Model Configuration Format\n\nThe model configuration is a simple YAML file with a `model_list` array:\n\n```yaml\nmodel_list:\n  - model_name: <name-for-your-app>\n    litellm_params:\n      model: <provider>/<model-id>\n      api_base: <api-endpoint>  # Optional\n      api_key: os.environ/<ENV_VAR_NAME>\n      # Additional parameters as needed\n```\n\n### Supported Providers\n\n- OpenAI and OpenAI-compatible endpoints\n- Anthropic (Claude)\n- Google (Gemini/Vertex)\n- Azure OpenAI\n- Local models (Ollama, etc.)\n- Any provider supported by LiteLLM\n\n## Security Notes\n\n- Generated projects include `env.example` as a template for API keys\n- Never commit `.env` files with actual API keys\n- Always use secure master keys in production\n\n## Contributing\n\nContributions are welcome! Please see our [Contributing Guide](docs/development/contributing.md) for details.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Built with [OmegaConf](https://github.com/omry/omegaconf) for robust configuration handling\n- Uses [Pixi](https://pixi.sh/) for environment management\n- Generates configurations for [LiteLLM](https://github.com/BerriAI/litellm)\n- Project structure based on [magic-context](https://github.com/igamenovoer/magic-context) templates\n\n## Contact\n\n- GitHub: [@igamenovoer](https://github.com/igamenovoer)\n- Issues: [GitHub Issues](https://github.com/igamenovoer/llm-anygate/issues)\n\n## Support\n\nFor questions, issues, or feature requests, please open an issue on GitHub.",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2024 igamenovoer\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "A flexible gateway for connecting and managing multiple LLM providers",
    "version": "1.0.4",
    "project_urls": {
        "Homepage": "https://github.com/igamenovoer/llm-anygate",
        "Issues": "https://github.com/igamenovoer/llm-anygate/issues",
        "Repository": "https://github.com/igamenovoer/llm-anygate"
    },
    "split_keywords": [
        "ai",
        " anthropic",
        " api",
        " gateway",
        " llm",
        " openai"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7939b520a89a9094fcb1cbc5c3dc217dffbf357fc110c4ad2738b4c59fcee5cc",
                "md5": "ccf1bd5fbceafc52a0ab733264c59f08",
                "sha256": "ba433ddd6d517e2f47a89ebb596d6f0b9c8d1ad20a8fecdd9994a474c405353d"
            },
            "downloads": -1,
            "filename": "llm_anygate-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ccf1bd5fbceafc52a0ab733264c59f08",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 15466,
            "upload_time": "2025-08-27T15:40:29",
            "upload_time_iso_8601": "2025-08-27T15:40:29.156744Z",
            "url": "https://files.pythonhosted.org/packages/79/39/b520a89a9094fcb1cbc5c3dc217dffbf357fc110c4ad2738b4c59fcee5cc/llm_anygate-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8f65f96f96bbb0cdc2c4fdc5fbfa6e017f5fc5d65c5b28fe79494caade21bf16",
                "md5": "142b6fe588420c3003dfc83c248612de",
                "sha256": "8e1e71cd93b5c427fc45fc3d123160e998da7655a6fc318f21351b33dfc892e7"
            },
            "downloads": -1,
            "filename": "llm_anygate-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "142b6fe588420c3003dfc83c248612de",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 67190,
            "upload_time": "2025-08-27T15:40:31",
            "upload_time_iso_8601": "2025-08-27T15:40:31.076042Z",
            "url": "https://files.pythonhosted.org/packages/8f/65/f96f96bbb0cdc2c4fdc5fbfa6e017f5fc5d65c5b28fe79494caade21bf16/llm_anygate-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-27 15:40:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "igamenovoer",
    "github_project": "llm-anygate",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "llm-anygate"
}
        
Elapsed time: 0.42304s