Build and deploy AI-powered APIs in seconds
Build and deploy AI-powered APIs in seconds. This project allows you to create custom APIs that extract structured data from websites using natural language descriptions, powered by LLMs and web scraping technology.
The LLM API Engine is designed with flexibility in mind:
This decoupled architecture means you can:
git clone https://github.com/developersdigest/llm-api-engine.git
cd llm-api-enginenpm install.env file with the following variables:OPENAI_API_KEY=your_openai_key
NEXT_PUBLIC_FIRECRAWL_API_KEY=your_firecrawl_key
SERPER_API_KEY=your_serper_key
UPSTASH_REDIS_REST_URL=your_redis_url
UPSTASH_REDIS_REST_TOKEN=your_redis_token
NEXT_PUBLIC_API_ROUTE=http://localhost:3000 # Your API base URLnpm run devOpen http://localhost:3000 to see the application.
The LLM API Engine is designed with a modular architecture that separates the API builder interface from the actual API endpoints. This means you can:
Use the Builder Interface Only
Independent API Deployment
// Example with Hono
import { Hono } from 'hono'
const app = new Hono()
app.get('/api/results/:endpoint', async (c) => {
const data = await redis.get(`api/results/${c.req.param('endpoint')}`)
return c.json(data)
})Hybrid Approach
This flexibility allows you to:
# Create an API to extract company information
curl -X POST "https://your-domain.com/api/deploy" \
-H "Content-Type: application/json" \
-d '{
"query": "Extract company name, revenue, and employee count",
"urls": ["https://example.com/company"],
"schedule": "0 5 * * *"
}'POST /api/generate-schema - Generate JSON schema from descriptionPOST /api/extract - Extract data from URLsPOST /api/deploy - Deploy a new API endpointGET /api/routes - List all deployed routesGET /api/results/:endpoint - Get results for a specific endpointThe LLM API Engine will support automated data updates through various CRON implementations:
Vercel Cron Jobs (Free Tier)
vercel.json:{
"crons": [{
"path": "/api/cron/update",
"schedule": "0 0 * * *"
}]
}Upstash QStash (Alternative)
GitHub Actions Workflow
Choose the implementation that best fits your needs based on:
Stay tuned for detailed implementation guides for each option!
To fetch data from your deployed endpoint:
curl -X GET "${API_ROUTE}/api/results/nvidia-market-cap" \
-H "Authorization: Bearer sk_your_api_key" \
-H "Content-Type: application/json"The API will return data in the following format:
{
"success": true,
"data": {
// Your extracted data here
},
"lastUpdated": "2024-01-01T00:00:00.000Z",
"sources": [
"https://example.com/source1",
"https://example.com/source2"
]
}git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
Currently working on implementing scheduled data extraction with the following planned features:
No open issues yet, or sync has not completed.