| Crates.io | crabrace |
| lib.rs | crabrace |
| version | 0.1.0 |
| created_at | 2025-10-29 02:14:56.822227+00 |
| updated_at | 2025-10-29 02:14:56.822227+00 |
| description | High-performance HTTP-based AI provider database service written in Rust |
| homepage | |
| repository | https://github.com/jyjeanne/crabrace |
| max_upload_size | |
| id | 1905943 |
| size | 562,396 |
Rust port of Catwalk - AI Provider Database
___ _
/ __|_ _ __ _| |__ _ _ __ _ __ ___
| (__| '_/ _` | '_ \ '_/ _` / _/ -_)
\___|_| \__,_|_.__/_| \__,_\__\___|
🦀 Fast • Safe • Reliable
A high-performance, memory-safe HTTP-based AI provider database service written in Rust. Rust port of Catwalk for the Crustly AI assistant.
Crabrace is a centralized registry service for AI inference providers (LLMs) and their models. It provides:
# Clone repository
git clone https://github.com/jyjeanne/crabrace.git
cd crabrace
# Build (See BUILD_WORKAROUND.md for Windows build issues)
cargo build --release
# Run
./target/release/crabrace
# Start server
crabrace
# Server starts on http://localhost:8080
# Query providers
curl http://localhost:8080/providers
# Health check
curl http://localhost:8080/health
# Metrics
curl http://localhost:8080/metrics
HTTP Layer (Axum + Tokio)
↓
Provider Registry (Lazy Static)
↓
Embedded JSON Configs (16+ providers)
↓
Data Models (Serde)
Key Features:
Returns all available AI providers and their models.
Response:
[
{
"name": "Anthropic",
"id": "anthropic",
"type": "anthropic",
"models": [
{
"id": "claude-sonnet-4-5-20250929",
"name": "Claude Sonnet 4.5",
"cost_per_1m_in": 3.0,
"cost_per_1m_out": 15.0,
"context_window": 200000
}
]
}
]
Health check endpoint.
Response: OK
Prometheus metrics.
| Metric | Catwalk (Go) | Crabrace (Rust) | Improvement |
|---|---|---|---|
| Startup Time | ~120ms | ~50ms | 2.4x faster |
| Memory (idle) | ~10MB | ~6MB | 40% less |
| Throughput | ~10k req/s | ~25k req/s | 2.5x higher |
| P99 Latency | ~25ms | ~12ms | 2x faster |
| Binary Size | ~15MB | ~8MB | 47% smaller |
| Safety | GC + Runtime | Compile-time | Zero runtime overhead |
Crabrace includes comprehensive performance testing infrastructure:
# Run Criterion benchmarks
cargo bench
# View detailed HTML reports
open target/criterion/report/index.html
Benchmark Coverage:
# Start server
cargo run --release &
# Run load tests
cd perf-tests
./load-test-bombardier.sh # Cross-platform
./load-test-wrk.sh # Linux/macOS
./load-test-ab.sh # Apache Bench
./stress-test.sh # Gradual load increase
Performance Targets:
See Performance Testing and Benchmark Results for details.
# Development build
cargo build
# Release build (optimized)
cargo build --release
# Small binary build
cargo build --profile release-small
# Run tests
cargo test
# Run benchmarks
cargo bench
# Lint code
cargo clippy
# Format code
cargo fmt
crabrace/
├── src/
│ ├── main.rs # HTTP server
│ ├── client.rs # HTTP client library
│ ├── models/
│ │ └── provider.rs # Data models
│ └── providers/
│ ├── registry.rs # Provider registry
│ └── configs/ # JSON configurations
├── tests/ # Integration tests
├── benches/ # Benchmarks
└── docs/ # Documentation
All 18 Providers Implemented:
[dependencies]
crabrace = "0.1"
use crabrace::CrabraceClient;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = CrabraceClient::new();
let providers = client.get_providers().await?;
for provider in providers {
println!("Provider: {}", provider.name);
}
Ok(())
}
# Build the image
docker build -t crabrace:latest .
# Run the container
docker run -d \
--name crabrace \
-p 8080:8080 \
-e RUST_LOG=info \
crabrace:latest
# Check logs
docker logs -f crabrace
# Test the API
curl http://localhost:8080/health
curl http://localhost:8080/providers
Run Crabrace with Docker Compose for easier management:
# Start Crabrace only
docker-compose up -d
# Start with monitoring stack (Prometheus + Grafana)
docker-compose --profile monitoring up -d
# View logs
docker-compose logs -f crabrace
# Stop services
docker-compose down
# Stop and remove volumes
docker-compose down -v
Access Services:
Multi-Stage Build:
Features:
Crabrace supports flexible configuration via environment variables, configuration files, or both.
Quick Configuration via Environment Variables:
| Variable | Default | Description |
|---|---|---|
CRABRACE_SERVER__HOST |
0.0.0.0 |
Server bind address |
CRABRACE_SERVER__PORT |
8080 |
Server port |
CRABRACE_LOGGING__LEVEL |
info |
Log level (trace, debug, info, warn, error) |
CRABRACE_LOGGING__JSON_FORMAT |
false |
Use JSON logging |
CRABRACE_METRICS__ENABLED |
true |
Enable metrics endpoint |
Using Configuration File:
# Copy and edit example config
cp config.toml.example config.toml
nano config.toml
# Run with custom config
docker run -v $(pwd)/config.toml:/app/config.toml crabrace:latest
See Configuration Guide for complete documentation
# Standard build
docker build -t crabrace:latest .
# Build with cache disabled
docker build --no-cache -t crabrace:latest .
# Build for specific platform
docker build --platform linux/amd64 -t crabrace:latest .
# Multi-platform build
docker buildx build --platform linux/amd64,linux/arm64 -t crabrace:latest .
Contributions welcome! Please read CONTRIBUTING.md for guidelines.
src/providers/configs/src/providers/registry.rsload_provider!() call in load_providers() methodtest_all_providers_loaded()MIT License - see LICENSE for details
| Phase | Status | Completion |
|---|---|---|
| Phase 1: Data Model | ✅ Complete | 100% |
| Phase 2: Infrastructure | ✅ Complete | 100% |
| Phase 3: Providers | ✅ Complete | 100% |
| Phase 4: Production | ✅ Complete | 100% |
| Feature | Status | Notes |
|---|---|---|
| Docker Support | ✅ Complete | Multi-stage builds, docker-compose |
| Configuration Management | ✅ Complete | Env vars, TOML, validation |
| Security Hardening | ✅ Complete | CORS, security headers (rate limiting: TODO) |
| Kubernetes Manifests | ✅ Complete | kubectl, Kustomize, Helm charts |
| Performance Testing | ✅ Complete | Criterion benchmarks, load tests |
Note: Rate limiting is temporarily disabled due to tower_governor 0.4.3 type compatibility issues. Will be re-enabled after upgrading to version 0.8.0+.
Built with 🦀 Rust • Ported from Catwalk (Go) • Part of Crustly