hyperinfer-core
Shared types, traits, and error handling for the HyperInfer LLM Gateway. This is the foundational crate used by all other HyperInfer components.
Key Types
| Type | Description |
|---|---|
ChatRequest |
Unified LLM chat request with model, messages, parameters |
ChatResponse |
LLM chat response with choices and usage |
ChatMessage |
Single message with role and content |
MessageRole |
User, assistant, system, or tool role enum |
Usage |
Token usage tracking (prompt, completion, total) |
Deployment |
Model deployment configuration with provider, model, and routing metadata |
Config |
Client configuration for API endpoints and team settings |
Key Traits
| Trait | Description |
|---|---|
Database |
Async persistence trait for teams, users, API keys, deployments (27 methods) |
ConfigStore |
Async config storage and Pub/Sub trait via Redis |
RateLimiter |
Distributed rate limiting using GCRA algorithm |
Error Types
HyperInferError— main error enum covering network, auth, rate-limit, serialization, etc.DbError— database-specific errors (not found, unique violation, connection)ConfigError— configuration parsing and validation errors
Cargo Features
test-mocks— enablesmockallfor mock implementations of traits in tests
Usage
[]
= "0.1"
License
GNU Affero General Public License v3.0 (AGPL-3.0-only)