Skip to main content

Unified Python SDK for chat completions across multiple AI providers

Project description

LLM-Router

Unified Python SDK for chat completions across OpenAI, Anthropic, and Google Gemini. All requests/responses use OpenAI format.

Clone the Project

git clone https://github.com/Deeptechs-ai/LLM-Router

Installation

uv sync

Terminal Usage

from gateway import chat_complete, ChatCompletionRequest, Message

request = ChatCompletionRequest(
    model="claude-sonnet-4-20250514",
    messages=[Message(role="user", content="Hello!")],
    max_tokens=100,
)

response = chat_complete(
    provider="anthropic",  # or "openai", "google"
    api_key="your-api-key",
    request=request,
)

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

Guardrails

Regex Guardrails

Regex guardrails let you block or flag sensitive content (SSNs, emails, credit cards, etc.) in both input and output messages using pattern matching.

Setup

  1. Create a YAML config file (see guardrails.example.yaml):

Each rule requires:

  • name: Identifier for the rule
  • pattern: Regex pattern to match
  • description: Human-readable description
  • action: block (raises GuardrailsError) or flag (logs a warning but allows the request)
  1. Set the environment variable to enable automatic loading:
GUARDRAILS_FILE_PATH=path-to-guardrails-config-yaml-file

Usage

Guardrails are applied automatically when GUARDRAILS_FILE_PATH is set. Both user input and LLM output are checked against all rules.

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

rezunate_llm_sdk-0.1.0.tar.gz (45.2 kB view details)

Uploaded Source

Built Distribution

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

rezunate_llm_sdk-0.1.0-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file rezunate_llm_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: rezunate_llm_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 45.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for rezunate_llm_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a37cd8fb7f4ba2b8a867d2d4feaa09e351d872e7819fd14c624320000dcbd0b2
MD5 73a34167b2f17c3c60795a1fa3763cdc
BLAKE2b-256 4f2f8a0f18bee031959cd569e924b54f12f8c318a04b5fca0cfd2363c6cdc41f

See more details on using hashes here.

File details

Details for the file rezunate_llm_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for rezunate_llm_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb0fc36f59afd036719209ecacc5c3069aaf909ca3929b0f6af0be31a3299633
MD5 af2b2e894cdccbff229da4a70ee5074a
BLAKE2b-256 e060b45d6e1f51037d35c931889846b91204b5b5c82795da8070620b91339a47

See more details on using hashes here.

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