Skip to main content

Lightweight internal utilities for LLM provider configuration and credential management

Project description

RealtimeX Internal Utilities

Lightweight internal library providing utilities for LLM provider configuration and credential management across RealtimeX internal services.

Installation

# Using uv (recommended)
uv pip install -e /path/to/realtimex-toolkit

# Using pip
pip install -e /path/to/realtimex-toolkit

Quick Start

LLM Provider Configuration

from realtimex import configure_provider, get_provider_env_vars

# Configure provider (sets environment variables)
env_vars = configure_provider("openai")

# Get provider env vars without setting them
env_vars = get_provider_env_vars("openai")

# With explicit providers
env_vars = configure_provider(
    "openai",
    providers={"openai": {"OPEN_AI_KEY": "sk-..."}}
)

Credential Management

Retrieve encrypted credentials from the RealtimeX app backend and decrypt them for use across RealtimeX ecosystem services.

from realtimex import get_credential

# Simplest usage - just the credential ID
# Connects to local RealtimeX backend (http://localhost:3001) by default
credential = await get_credential("credential-id")
print(credential["payload"])  # {"name": "API_KEY", "value": "secret-value"}

# With API key for authenticated requests
credential = await get_credential("credential-id", api_key="service-api-key")

# With custom backend URL (for non-default configurations)
credential = await get_credential(
    "credential-id",
    api_key="service-api-key",
    base_url="http://custom-host:3001"  # Override default localhost:3001
)

# For long-running services, use CredentialManager directly
from realtimex import CredentialManager

# Connects to http://localhost:3001 by default
manager = CredentialManager(api_key="service-api-key")
try:
    bundle = await manager.get("credential-id")
    # Credentials are cached automatically
    bundle_again = await manager.get("credential-id")  # Returns cached

    # Force refresh from backend
    fresh_bundle = await manager.get("credential-id", force_refresh=True)
finally:
    await manager.close()

Configuration:

  • base_url: Base URL of the RealtimeX app backend (default: http://localhost:3001)
  • api_key: Authentication token for backend API requests (optional)
  • Credentials are encrypted using AES-256-CBC and decrypted using keys from ~/.realtimex.ai/Resources/server/.env.development

Return shape (get_credential):

{
    "credential_id": str,
    "name": str,
    "credential_type": str,
    "payload": dict[str, str],
    "metadata": dict | None,
    "updated_at": str | None,
}

Supported LLM Providers

  • Major Providers: OpenAI, Anthropic, Azure OpenAI
  • Cloud AI: Google Gemini, AWS Bedrock
  • Alternative APIs: Groq, Cohere, Mistral, Perplexity
  • Open Source Aggregators: Open Router, Together AI, Fireworks AI
  • Emerging: DeepSeek, xAI, Novita
  • Local Deployment: Ollama, LocalAI, LM Studio, KoboldCPP
  • Custom: Generic OpenAI, LiteLLM, Nvidia NIM, Hugging Face

Development

# Install with dev dependencies
uv pip install -e ".[dev]"

# Run tests
pytest

# Run type checking
mypy src/realtimex

# Format & lint
ruff check src/realtimex tests
ruff format src/realtimex tests

Architecture

  • realtimex.llm: LLM provider configuration utilities
  • realtimex.credentials: Secure credential retrieval and decryption
  • realtimex.api: HTTP client with retry logic and error mapping
  • realtimex.utils: Internal utilities (path resolution, logging)

License

Proprietary - Internal use only

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

realtimex_toolkit-1.0.1.tar.gz (104.6 kB view details)

Uploaded Source

Built Distribution

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

realtimex_toolkit-1.0.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file realtimex_toolkit-1.0.1.tar.gz.

File metadata

  • Download URL: realtimex_toolkit-1.0.1.tar.gz
  • Upload date:
  • Size: 104.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.16

File hashes

Hashes for realtimex_toolkit-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0d6861bd9ba6088c2ecf98a1f48e1bbe771db58669746df2de3d6fda6efdded0
MD5 90ea87ee6ad55f4c5567c5e20c9b20f1
BLAKE2b-256 8854728f2c70771f7550d1f30d381568a4f79af0de796dbff6c76c36561ba634

See more details on using hashes here.

File details

Details for the file realtimex_toolkit-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for realtimex_toolkit-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 319b249de37e4f709cccf88604a7afa3e628d90fcba4c1246b235b2c66c7afc8
MD5 2b64f8ce48a280c5b54d745fc7c6d214
BLAKE2b-256 cea53cafa26c4121dcb21bc3ab291df14ff6c204fbb8c37edcddfad6c9e032a6

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