pcpartspicker
v1.0.0
Published
AI-powered PC parts configuration generator using OpenAI's GPT model
Maintainers
Readme
PCPartsPickerAI
An intelligent Express middleware that generates optimized PC configurations based on budget, purpose, and preferences using OpenAI's GPT model. Provided by PCPartsPicker.
Features
- Generate complete PC builds within specified budget
- Optimize builds for different purposes (gaming, productivity, content creation, etc.)
- Consider user preferences for specific brands or components
- Include detailed specifications and reasoning for each component
- Caching system to reduce API calls
- Built-in budget validation
- Component categories reference
Installation
npm install pcpartspickerUsage
const express = require('express');
const createPCPartsGenerator = require('pcpartspicker');
const app = express();
const OPENAI_API_KEY = 'your-api-key-here';
app.use('/pcbuild', createPCPartsGenerator(OPENAI_API_KEY));
app.listen(3000, () => {
console.log('Server is running on port 3000');
});Generate PC Build
Send a POST request to /pcbuild with the following body:
{
"budget": 2000,
"purpose": "gaming",
"preferences": {
"cpu_brand": "AMD",
"gpu_brand": "NVIDIA",
"case_size": "mid-tower"
},
"token": "unique-user-token"
}Response Example
{
"configuration": {
"cpu": {
"name": "AMD Ryzen 7 5800X",
"price": 449.99,
"specs": "8 cores, 16 threads, 3.8GHz base, 4.7GHz boost",
"reason": "Excellent gaming performance and multi-tasking capabilities"
},
"motherboard": {
"name": "MSI MPG B550 GAMING EDGE WIFI",
"price": 179.99,
"specs": "AM4 socket, WiFi 6, PCIe 4.0",
"reason": "Great features for the price, good VRM for 5800X"
},
// ... other components
},
"metadata": {
"budget": 2000,
"purpose": "gaming",
"preferences": {
"cpu_brand": "AMD",
"gpu_brand": "NVIDIA",
"case_size": "mid-tower"
},
"timestamp": "2024-10-23T12:00:00Z"
}
}Get Component Categories
Send a GET request to /pcbuild/categories
Validate Budget
Send a GET request to /pcbuild/validate-budget/2000
API Endpoints
POST /pcbuild- Generate PC configurationGET /pcbuild/categories- Get list of component categoriesGET /pcbuild/validate-budget/:amount- Validate budget amount
Configuration Options
Budget
- Minimum: $500
- Maximum: $10,000 (with warning for very high budgets)
Purposes
- Gaming
- Content Creation
- Office/Productivity
- Software Development
- 3D Rendering
- Streaming
- General Use
Preferences
- CPU brand (AMD/Intel)
- GPU brand (NVIDIA/AMD)
- Case size (small/mid/full tower)
- Color scheme
- RGB preferences
- Specific brand preferences
- Cooling preferences (air/liquid)
Caching
Results are cached for 1 hour to reduce API calls and improve response times.
Error Handling
The middleware includes comprehensive error handling for:
- Invalid budgets
- Missing required fields
- API failures
- Invalid JSON responses
Note
This package requires a valid OpenAI API key. Keep your API key secure and never expose it in your code.
