🖼️ Galleried API
AI-powered collectible image analysis API
Available Endpoints
- POST /api/trpc/collectibles.detectCategory
Analyze an image to identify the best matching collectible category
Includes automatic image compression and detailed analysis - GET /api/trpc/collectibles.getCategories
Get all available collectible categories with slugs - GET /api/trpc/collectibles.health
Health check endpoint - POST /api/trpc/collectibles.testImage
Debug endpoint for testing image format and validation
Features
- 🤖 AI-Powered Analysis - Uses OpenAI GPT-4o-mini for image recognition
- 🗜️ Automatic Image Compression - Optimizes images to 1024x1024 max with 85% JPEG quality
- 📊 Performance Monitoring - Detailed timing logs for each processing step
- 🎯 Single Best Match - Returns the most confident category prediction
- 🔍 Detailed Analysis - Provides reasoning and detected features
- 🏷️ Category Slugs - URL-friendly category identifiers
- ⚡ Type-Safe API - Full TypeScript support via tRPC
Error Handling
Common Error Codes
- BAD_REQUEST - Invalid image format or validation failed
- PAYMENT_REQUIRED - AI service quota exceeded
- TOO_MANY_REQUESTS - Rate limit exceeded
- TIMEOUT - Request timed out
- NOT_FOUND - Could not match collectible to any category
- INTERNAL_SERVER_ERROR - Configuration or unexpected errors
Image Requirements
- Formats: JPEG, PNG, WebP
- Max Size: 10MB (automatically compressed to optimal size)
- Input: Base64 encoded with data URL prefix
- Optimal: Images are automatically resized to 1024x1024 max
Usage
This API uses tRPC for type-safe communication. Install the client package and use the generated types for full TypeScript support. See the mobile app for integration examples.