How itsomshree/unified-ai-api works
Unified AI Inference API: clients authenticate, upload images when needed, submit predictions, and retrieve results or history; async jobs are queued for worker execution and can trigger signed webhook notifications. The graph also covers authentication, rate limiting, tracing, metrics, and file handling. Relationships are based on README statements and SOURCE INDEX references; unsampled subsystem internals are represented only where the documented capabilities or indexed references support them.
Main entry points: inference_service.py Inference Service · celery_tasks.py Celery Worker · dependencies.py Credential Resolution · inference.py Inference Routes
Components 26
API and Access
- Auth Routes
app/api/v1/auth.py - Inference Routes
app/api/v1/inference.py - History Routes
app/api/v1/history.py - File Routes
app/api/v1/files.py - Webhook Routes
app/api/v1/webhooks.py
Identity and Files
- Auth Service
app/services/auth_service.py - Credential Resolution
app/core/dependencies.py - Security Primitives
app/core/security.py - File Service
app/services/file_service.py - User Records
app/models/user.py - API Key Records
app/models/api_key.py - Uploaded File Records
app/models/uploaded_file.py
Inference
- Inference Service
app/services/inference_service.py - Model Registry
app/ml/registry.py - Prediction Models
app/ml - Prediction Records
app/models/prediction.py - History Service
app/services/history_service.py
Async and Webhooks
- Celery Worker
app/tasks/celery_tasks.py - Webhook Delivery
app/services/notification_service.py - Webhook Management
app/services/webhook_service.py - Webhook Records
app/models/webhook.py
Platform Services
- PostgreSQL
- Redis
- Rate Limiting
app/core/rate_limit.py - Tracing and Metrics
app/core/request_context.py
Other components
- API Client
Connections 43
- API Client → Auth Routes: registers or logs in
- API Client → Inference Routes: submits predictions
- API Client → File Routes: uploads images
- API Client → History Routes: requests history
- API Client → Webhook Routes: manages webhooks
- Auth Routes → Auth Service: calls
app/api/v1/auth.py - Auth Service → Security Primitives: uses
app/services/auth_service.py - Auth Service → User Records: creates and reads
app/services/auth_service.py - Auth Service → API Key Records: manages
app/services/auth_service.py - Auth Routes → Credential Resolution: requires
app/api/v1/auth.py - Inference Routes → Credential Resolution: requires
app/api/v1/inference.py - File Routes → Credential Resolution: requires
app/api/v1/files.py - Webhook Routes → Credential Resolution: requires
app/api/v1/webhooks.py - Credential Resolution → Security Primitives: validates credentials
app/core/dependencies.py - Credential Resolution → User Records: looks up users
app/core/dependencies.py - Credential Resolution → API Key Records: looks up keys
app/core/dependencies.py - File Routes → File Service: calls
app/api/v1/files.py - File Service → Uploaded File Records: persists metadata
app/services/file_service.py - File Service → PostgreSQL: reads and writes
app/services/file_service.py - Inference Routes → Rate Limiting: applies limits
app/api/v1/inference.py - Inference Routes → Inference Service: calls
app/api/v1/inference.py - Inference Service → Model Registry: selects model
app/services/inference_service.py - Model Registry → Prediction Models: registers models
app/ml/loaders.py - Inference Service → Prediction Records: records predictions
app/services/inference_service.py - Inference Service → PostgreSQL: writes prediction
app/services/inference_service.py - Inference Service → File Service: resolves image file
app/services/inference_service.py - Inference Service → Celery Worker: queues async job
app/services/inference_service.py - History Routes → History Service: calls
app/api/v1/history.py - History Routes → Inference Service: checks prediction status
app/api/v1/history.py - History Service → Prediction Records: queries history
- Celery Worker → Prediction Records: loads and updates
app/tasks/celery_tasks.py - Celery Worker → PostgreSQL: reads and writes
app/tasks/celery_tasks.py - Celery Worker → Model Registry: selects model
app/tasks/celery_tasks.py - Celery Worker → Webhook Delivery: triggers delivery
app/tasks/celery_tasks.py - Inference Service → Redis: queues through broker
- Celery Worker → Redis: receives queued tasks
- Webhook Routes → Webhook Management: calls
app/api/v1/webhooks.py - Webhook Management → Webhook Records: manages registration
app/services/webhook_service.py - Webhook Delivery → Webhook Records: loads recipient
app/services/notification_service.py - Webhook Delivery → Security Primitives: signs delivery
app/services/notification_service.py - Rate Limiting → Redis: checks request windows
app/core/rate_limit.py - Celery Worker → Tracing and Metrics: binds request ID
app/tasks/celery_tasks.py - Inference Service → Tracing and Metrics: propagates request ID
app/services/inference_service.py