freshcrate
Skin:/

hub

High-scale LLM gateway, written in Rust. OpenTelemetry-based observability included

Why this rank:Strong adoptionRecent releaseHealthy release cadence

Description

High-scale LLM gateway, written in Rust. OpenTelemetry-based observability included

README

Open-source, high-performance LLM gateway written in Rust. Connect to any LLM provider with a single API. Observability Included.

Traceloop Hub is a next-gen high-performance LLM gateway written in Rust that centralizes control and tracing of all LLM calls. It provides a unified OpenAI-compatible API for connecting to multiple LLM providers with observability built-in.

Features

  • Multi-Provider Support: OpenAI, Anthropic, Azure OpenAI, Google VertexAI, AWS Bedrock
  • OpenAI Compatible API: Drop-in replacement for OpenAI API calls
  • Two Deployment Modes:
    • YAML Mode: Simple static configuration with config files
    • Database Mode: Dynamic configuration with PostgreSQL and Management API
  • Built-in Observability: OpenTelemetry tracing and Prometheus metrics
  • High Performance: Written in Rust with async/await support
  • Hot Reload: Dynamic configuration updates (Database mode)
  • Pipeline System: Extensible request/response processing
  • Unified Architecture: Single crate structure with integrated Management API

Quick Start

Using Docker

# YAML Mode (simple deployment)
docker run -p 3000:3000 -v $(pwd)/config.yaml:/app/config.yaml traceloop/hub

# Database Mode (with management API)
docker run -p 3000:3000 -p 8080:8080 \
  -e HUB_MODE=database \
  -e DATABASE_URL=postgresql://user:pass@host:5432/db \
  traceloop/hub

Using Cargo

# Clone and build
git clone https://github.com/traceloop/hub.git
cd hub
cargo build --release

# YAML Mode
./target/release/hub

# Database Mode  
HUB_MODE=database DATABASE_URL=postgresql://user:pass@host:5432/db ./target/release/hub

Architecture

The project uses a unified single-crate architecture:

hub/
โ”œโ”€โ”€ src/                        # Main application code
โ”‚   โ”œโ”€โ”€ main.rs                 # Application entry point
โ”‚   โ”œโ”€โ”€ lib.rs                  # Library exports
โ”‚   โ”œโ”€โ”€ config/                 # Configuration management
โ”‚   โ”œโ”€โ”€ providers/              # LLM provider implementations
โ”‚   โ”œโ”€โ”€ models/                 # Data models
โ”‚   โ”œโ”€โ”€ pipelines/              # Request processing pipelines
โ”‚   โ”œโ”€โ”€ routes.rs               # HTTP routing
โ”‚   โ”œโ”€โ”€ state.rs                # Application state management
โ”‚   โ”œโ”€โ”€ management/             # Management API (Database mode)
โ”‚   โ”‚   โ”œโ”€โ”€ api/                # REST API endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ db/                 # Database models and repositories
โ”‚   โ”‚   โ”œโ”€โ”€ services/           # Business logic
โ”‚   โ”‚   โ””โ”€โ”€ dto.rs              # Data transfer objects
โ”‚   โ””โ”€โ”€ types/                  # Shared type definitions
โ”œโ”€โ”€ migrations/                 # Database migrations
โ”œโ”€โ”€ helm/                       # Kubernetes deployment
โ”œโ”€โ”€ tests/                      # Integration tests
โ””โ”€โ”€ docs/                       # Documentation

Configuration Modes

YAML Mode

Perfect for simple deployments and development environments.

Features:

  • Static configuration via config.yaml
  • No external dependencies
  • Simple provider and model setup
  • No management API
  • Single port (3000)

Example config.yaml:

providers:
  - key: openai
    type: openai
    api_key: sk-...

models:
  - key: gpt-4
    type: gpt-4
    provider: openai

pipelines:
  - name: chat
    type: Chat
    plugins:
      - ModelRouter:
          models: [gpt-4]

Database Mode

Ideal for production environments requiring dynamic configuration.

Features:

  • PostgreSQL-backed configuration
  • REST Management API (/api/v1/management/*)
  • Hot reload without restarts
  • Configuration polling and synchronization
  • SecretObject system for credential management
  • Dual ports (3000 for Gateway, 8080 for Management)

Setup:

  1. Set up PostgreSQL database

  2. Run migrations: sqlx migrate run

  3. Set environment variables:

    HUB_MODE=database
    DATABASE_URL=postgresql://user:pass@host:5432/db

API Endpoints

Core LLM Gateway (Both Modes)

Port 3000:

  • POST /api/v1/chat/completions - Chat completions
  • POST /api/v1/completions - Text completions
  • POST /api/v1/embeddings - Text embeddings
  • GET /health - Health check
  • GET /metrics - Prometheus metrics
  • GET /swagger-ui - OpenAPI documentation

Management API (Database Mode Only)

Port 8080:

  • GET /health - Management API health check
  • GET|POST|PUT|DELETE /api/v1/management/providers - Provider management
  • GET|POST|PUT|DELETE /api/v1/management/model-definitions - Model management
  • GET|POST|PUT|DELETE /api/v1/management/pipelines - Pipeline management

Provider Configuration

OpenAI

providers:
  - key: openai
    type: openai
    api_key: sk-...
    # Optional
    organization_id: org-...
    base_url: https://api.openai.com/v1

Anthropic

providers:
  - key: anthropic
    type: anthropic
    api_key: sk-ant-...

Azure OpenAI

providers:
  - key: azure
    type: azure
    api_key: your-key
    resource_name: your-resource
    api_version: "2023-05-15"

AWS Bedrock

providers:
  - key: bedrock
    type: bedrock
    region: us-east-1
    # Uses IAM roles or AWS credentials

Google VertexAI

Supports two authentication modes that route to different Google APIs:

# Option 1: API Key (uses Gemini Developer API)
providers:
  - key: vertexai
    type: vertexai
    api_key: your-gemini-api-key

# Option 2: Service Account (uses Vertex AI)
providers:
  - key: vertexai
    type: vertexai
    project_id: your-project
    location: us-central1
    credentials_path: /path/to/service-account.json
Auth Method API Endpoint Use Case
API Key generativelanguage.googleapis.com Simple setup, development
Service Account {location}-aiplatform.googleapis.com Enterprise, GCP-integrated

Deployment

Helm Chart

# YAML Mode
helm install hub ./helm

# Database Mode
helm install hub ./helm \
  --set management.enabled=true \
  --set management.database.host=postgres \
  --set management.database.existingSecret=postgres-secret

Docker Compose

docker compose example

version: '3.8'
services:
  # YAML Mode
  hub-yaml:
    image: traceloop/hub
    ports:
      - "3000:3000"
    volumes:
      - ./config.yaml:/app/config.yaml

  # Database Mode
  hub-database:
    image: traceloop/hub
    ports:
      - "3000:3000"
      - "8080:8080"
    environment:
      - HUB_MODE=database
      - DATABASE_URL=postgresql://hub:password@postgres:5432/hub
    depends_on:
      - postgres

  postgres:
    image: postgres:15
    environment:
      - POSTGRES_DB=hub
      - POSTGRES_USER=hub
      - POSTGRES_PASSWORD=password

Environment Variables

Variable Description Default Required
HUB_MODE Deployment mode: yaml or database yaml No
CONFIG_FILE_PATH Path to YAML config file config.yaml YAML mode
DATABASE_URL PostgreSQL connection string - Database mode
DB_POLL_INTERVAL_SECONDS Config polling interval 30 No
PORT Gateway server port 3000 No
MANAGEMENT_PORT Management API port 8080 Database mode
TRACE_CONTENT_ENABLED Enable request/response tracing true No

Development

Prerequisites

  • Rust 1.87+
  • PostgreSQL 12+ (for database mode)
  • sqlx-cli (for migrations)

Commands

# Build OSS version
cargo build

# Test
cargo test

# Format
cargo fmt

# Lint
cargo clippy

# Run YAML mode
cargo run

# Run database mode
HUB_MODE=database DATABASE_URL=postgresql://... cargo run

Database Setup (for Database Mode)

# Install sqlx-cli
cargo install sqlx-cli --no-default-features --features postgres

# Run migrations
sqlx migrate run

# Use setup script for complete setup
./scripts/setup-db.sh

Project Structure

The project follows a unified single-crate architecture:

  • src/main.rs: Application entry point with mode detection
  • src/lib.rs: Library exports for all modules
  • src/config/: Configuration management and validation
  • src/providers/: LLM provider implementations
  • src/models/: Request/response data models
  • src/pipelines/: Request processing pipelines
  • src/management/: Management API (Database mode)
  • src/types/: Shared type definitions
  • src/state.rs: Thread-safe application state
  • src/routes.rs: Dynamic HTTP routing

Key Features

  • Hot Reload: Configuration changes without restarts (Database mode)
  • Atomic Updates: Thread-safe configuration updates
  • Dynamic Routing: Pipeline-based request steering
  • Comprehensive Testing: Integration tests with testcontainers
  • OpenAPI Documentation: Auto-generated API specs

Observability

OpenTelemetry Tracing

Configure in your pipeline:

pipelines:
  - name: traced-chat
    type: Chat
    plugins:
      - Tracing:
          endpoint: http://jaeger:14268/api/traces
          api_key: your-key
      - ModelRouter:
          models: [gpt-4]

Prometheus Metrics

Available at /metrics:

  • Request counts and latencies
  • Provider-specific metrics
  • Error rates
  • Active connections

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Client App    โ”‚โ”€โ”€โ”€โ–ถโ”‚  Traceloop Hub   โ”‚โ”€โ”€โ”€โ–ถโ”‚   LLM Provider  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚                  โ”‚    โ”‚  (OpenAI, etc.) โ”‚
                       โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚  โ”‚ Config Mode โ”‚ โ”‚
                       โ”‚  โ”‚ YAML | DB   โ”‚ โ”‚    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                       โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚โ”€โ”€โ”€โ–ถโ”‚   Observability โ”‚
                       โ”‚                  โ”‚    โ”‚ (OTel, Metrics) โ”‚
                       โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚  โ”‚ Management  โ”‚ โ”‚
                       โ”‚  โ”‚ API (DB)    โ”‚ โ”‚
                       โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

License

Licensed under the Apache License, Version 2.0. See LICENSE for details.

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Support

Release History

VersionChangesUrgencyDate
0.9.2## v0.9.2 (2026-06-01) ### Fix - **models**: Add slug and provider to the model response schema (#104) [main 4d5854a] bump: version 0.9.1 โ†’ 0.9.2 4 files changed, 9 insertions(+), 3 deletions(-) High6/1/2026
0.9.1## v0.9.1 (2026-05-03) ### Fix - **openai**: support reasoning effort (#101) [main 302730e] bump: version 0.9.0 โ†’ 0.9.1 4 files changed, 9 insertions(+), 3 deletions(-) High5/3/2026
0.9.0## v0.9.0 (2026-04-15) ### Feat - Expose model provider header (#100) ### Fix - **anthropic**: drop top_p when both temperature and top_p are set + flatten response (#99) [main 156dfa7] bump: version 0.8.0 โ†’ 0.9.0 4 files changed, 13 insertions(+), 3 deletions(-) High4/15/2026
0.8.0## v0.8.0 (2026-03-04) ### Feat - add base_url support for OpenAI provider in managed mode (#98) [main 95b5880] bump: version 0.7.7 โ†’ 0.8.0 4 files changed, 9 insertions(+), 3 deletions(-) Low3/4/2026
0.7.7## v0.7.7 (2026-02-08) ### Fix - distroless base image reducing CVEs from 89 to 10 (#96) [main 3168e81] bump: version 0.7.6 โ†’ 0.7.7 4 files changed, 9 insertions(+), 3 deletions(-) Low2/8/2026
0.7.6## v0.7.6 (2026-01-18) ### Fix - typo in hub_mode env var (#90) [main c202c7a] bump: version 0.7.5 โ†’ 0.7.6 4 files changed, 9 insertions(+), 3 deletions(-) Low1/18/2026
0.7.5## v0.7.5 (2026-01-14) ### Fix - **vertexai**: support API key auth via Gemini Developer API (#87) - **helm**: deploy using helm chart (#83) - remove deploy to old staging CD phase (#84) [main 0e3ff54] bump: version 0.7.4 โ†’ 0.7.5 4 files changed, 11 insertions(+), 3 deletions(-) Low1/14/2026
0.7.4## v0.7.4 (2026-01-07) ### Fix - **czn**: manual bump (#82) - **helm**: deployment using helm chart (#80) - **ci**: lock version (#75) - **openai**: add tool_call_id request param (#73) - sync versions to 0.7.2 and migrate to .cz.yaml config (#70) - max_tokens change to max_completion_tokens (#68) - **tracing**: add vendor reporting for OTEL tracing (#64) [main 78f94b7] bump: version 0.7.3 โ†’ 0.7.4 4 files changed, 18 insertions(+), 7 deletions(-) Low1/7/2026
0.7.1## v0.7.1 (2025-08-10) ### Fix - fix bump package (#67) - revert tower http request (#66) [main dd20bf0] bump: version 0.7.0 โ†’ 0.7.1 3 files changed, 9 insertions(+), 2 deletions(-) Low8/10/2025
0.7.0## v0.7.0 (2025-08-10) ### Feat - add reasoning support (#63) ### Fix - make effort optional for gemini (#65) [main 9598956] bump: version 0.6.2 โ†’ 0.7.0 3 files changed, 13 insertions(+), 3 deletions(-) Low8/10/2025
0.6.2## v0.6.2 (2025-08-07) ### Fix - gemini enum support (#62) [main 7af3a85] bump: version 0.6.1 โ†’ 0.6.2 3 files changed, 9 insertions(+), 3 deletions(-) Low8/7/2025
0.6.1## v0.6.1 (2025-08-06) ### Fix - **deps**: revert commitizen tower version bump (#61) [main bccdeb6] bump: version 0.6.0 โ†’ 0.6.1 3 files changed, 9 insertions(+), 3 deletions(-) Low8/6/2025
0.6.0## v0.6.0 (2025-08-06) ### Feat - add gemini structure output (#60) [main db21b19] bump: version 0.5.1 โ†’ 0.6.0 3 files changed, 9 insertions(+), 3 deletions(-) Low8/6/2025
0.5.1## v0.5.1 (2025-08-06) ### Fix - gemini system prompt (#59) [main 29dcca9] bump: version 0.5.0 โ†’ 0.5.1 3 files changed, 8 insertions(+), 2 deletions(-) Low8/6/2025
0.5.0## v0.5.0 (2025-08-03) ### Feat - **models**: add filtered model info retrieval and response structures (#51) - management API (#39) ### Fix - **config**: allow env vars (#58) - **Dockerfile**: specify compatible sqlx-cli version for edition2021 (#54) - simplify string formatting to remove clippy warnings (#53) [main 4192d28] bump: version 0.4.5 โ†’ 0.5.0 3 files changed, 15 insertions(+), 2 deletions(-) Low8/3/2025
0.4.5## v0.4.5 (2025-06-25) ### Fix - **deps**: revert commitizen unwanted chrono version change (#49) [main 4c00f56] bump: version 0.4.4 โ†’ 0.4.5 3 files changed, 8 insertions(+), 2 deletions(-) Low6/25/2025
0.4.4## v0.4.4 (2025-06-24) ### Fix - **bedrock**: handle ARN and inference profile identifiers without transformation (#48) - **bedrock**: support IAM role auth (#47) [main 7ca1783] bump: version 0.4.3 โ†’ 0.4.4 3 files changed, 10 insertions(+), 3 deletions(-) Low6/24/2025
0.4.3## v0.4.3 (2025-05-29) ### Fix - make general optional again (#43) [main 0beb6ad] bump: version 0.4.2 โ†’ 0.4.3 3 files changed, 8 insertions(+), 2 deletions(-) Low5/29/2025
0.4.2## v0.4.2 (2025-05-22) ### Fix - **tracing**: support disabling tracing of prompts and completions (#42) [main 7ddea64] bump: version 0.4.1 โ†’ 0.4.2 3 files changed, 8 insertions(+), 2 deletions(-) Low5/22/2025
0.4.1## v0.4.1 (2025-05-20) ### Fix - **openai**: support custom base URL (#40) - **azure**: add support for custom base URL in AzureProvider endpoint (#41) [main 05c8e3f] bump: version 0.4.0 โ†’ 0.4.1 3 files changed, 9 insertions(+), 2 deletions(-) Low5/20/2025
0.4.0## v0.4.0 (2025-05-16) ### Feat - **provider**: add Google VertexAI support (#24) - support AWS bedrock base models (#25) - add max_completion_tokens to ChatCompletionRequest (#36) - support structured output (#33) ### Fix - replace eprintln with tracing info for API request errors in Azure and OpenAI providers (#37) - make optional json_schema field to ResponseFormat (#35) [main 851ecb4] bump: version 0.3.0 โ†’ 0.4.0 3 files changed, 16 insertions(+), 2 deletions(-) Low5/16/2025
0.3.0## v0.3.0 (2025-03-04) ### Feat - add logprobs and top_logprobs options to ChatCompletionRequest (#27) ### Fix - **cd**: correct docker hub secrets (#31) - **azure**: embeddings structs improvement (#29) - add proper error logging for azure and openai calls (#18) - **anthropic**: separate system from messages (#17) [main d1c3e24] bump: version 0.2.1 โ†’ 0.3.0 2 files changed, 14 insertions(+), 1 deletion(-) Low3/4/2025
0.2.1## v0.2.1 (2024-12-01) ### Fix - tool call support (#16) - restructure providers, separate request/response conversion (#15) [main 6ca2353] bump: version 0.2.0 โ†’ 0.2.1 2 files changed, 8 insertions(+), 1 deletion(-) Low12/1/2024
0.2.0## v0.2.0 (2024-11-25) ### Feat - **openai**: support streaming (#10) - add prometheus metrics (#13) - **cd**: deploy to traceloop on workflow distpatch (#11) ### Fix - config file path from env var instead of command argument (#12) [main dc7167d] bump: version 0.1.0 โ†’ 0.2.0 3 files changed, 17 insertions(+), 5 deletions(-) Low11/25/2024
0.1.0## v0.1.0 (2024-11-16) ### Feat - otel support (#7) - implement pipeline steering logic (#5) - dynamic pipeline routing (#4) - azure openai provider (#3) - initial completions and embeddings routes with openai and anthropic providers (#1) ### Fix - dockerfile and release pipeline (#2) - make anthropic work (#8) - cleanups; lint warnings fail CI (#9) - missing model name in response; 404 for model not found (#6) [main 2c861ed] bump: version 0.0.1 โ†’ 0.1.0 2 files changed, 17 insertions(+), 1Low11/16/2024

Dependencies & License Audit

Loading dependencies...

Similar Packages

tensorzeroTensorZero is an open-source LLMOps platform that unifies an LLM gateway, observability, evaluation, optimization, and experimentation.2026.6.0
swiftideFast, streaming indexing, query, and agentic LLM applications in Rustv0.32.1
awesome-opensource-aiCurated list of the best truly open-source AI projects, models, tools, and infrastructure.main@2026-06-06
MiniSearchMinimalist web-searching platform with an AI assistant that runs directly from your browser. Uses WebLLM, Wllama and SearXNG. Demo: https://felladrin-minisearch.hf.spacemain@2026-06-05
langgraphjsFramework to build resilient language agents as graphs.@langchain/svelte@1.0.16

More in Infrastructure

tensorzeroTensorZero is an open-source LLMOps platform that unifies an LLM gateway, observability, evaluation, optimization, and experimentation.
planoPlano is an AI-native proxy and data plane for agentic apps โ€” with built-in orchestration, safety, observability, and smart LLM routing so you stay focused on your agents core logic.
modelsThis repository contains comprehensive pricing and configuration data for LLMs. It powers cost attribution for 200+ enterprises running 400B+ tokens through Portkey AI Gateway every day.
edgeeOpen-source AI gateway written in Rust, with token compression for Claude Code, Codex... and any other LLM client.