The Gemini Proxy API is a powerful AI-powered service that uses Google's Gemini AI to identify and match categories from text content. The API follows RESTful principles and provides comprehensive OpenAPI documentation.
http://localhost:4000
Note: The server may run on different ports based on your .env configuration. Check the console output when starting the server to confirm the exact port.
Endpoint: POST /identifyCategories
Purpose: Analyzes a paragraph of text and identifies up to 3 categories that best match its content using Google Gemini AI.
Method: POST
Content-Type: application/json
Request Body:
{
"categories": ["Technology", "Science", "Business", "Health", "Education"],
"paragraph": "The rapid advancement in artificial intelligence and machine learning is transforming how businesses operate globally, creating new opportunities and challenges in the digital economy."
}Field Descriptions:
categories(required): Array of strings representing the available categories to match against. Must contain at least one category.paragraph(required): The text content to analyze for category identification. Should be meaningful text for AI analysis.
Success Response (200 OK):
{
"success": true,
"matchingCategories": ["Technology", "Business"],
"totalCategoriesProvided": 5
}Error Response (400 Bad Request):
{
"success": false,
"error": "Failed to process category identification",
"message": "Categories array is required and must not be empty"
}Error Response (500 Internal Server Error):
{
"success": false,
"error": "Failed to process category identification",
"message": "Failed to process category identification request"
}success: Boolean indicating if the request was processed successfullymatchingCategories: Array of category names that best match the paragraph (maximum 3)totalCategoriesProvided: Total number of categories provided in the original requesterror: Error type/category (only in error responses)message: Detailed error message (only in error responses)
Endpoint: GET /docs
Purpose: Provides an interactive web interface for exploring and testing the API using Scalar UI.
Method: GET
No request body required
Browser Access:
http://localhost:4000/docs
- Interactive API documentation
- Try-it functionality for testing endpoints
- Schema visualization
- Example payloads and responses
- Real-time API testing
Endpoint: POST /analyzeYouTubeVideo
Purpose: Analyzes a YouTube video from a Jewish philosophy website and identifies up to 3 categories that best match its content using Google Gemini AI. Returns both description and categories in Hebrew.
Method: POST
Content-Type: application/json
Request Body:
{
"youtubeUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"categories": ["פילוסופיה יהודית", "תורה", "חסידות", "קבלה", "מחשבה יהודית"]
}Field Descriptions:
youtubeUrl(required): YouTube URL from a Jewish philosophy website to analyze. Must be a valid YouTube URL.categories(required): Array of category strings in Hebrew that will be used to match against the video content. Must contain at least one category.
Success Response (200 OK):
{
"success": true,
"description": "הסרטון דן ברעיונות הפילוסופיים של הרב קוק בעניין התחייה הלאומית והקשר בין האומה לטבע",
"categories": ["פילוסופיה יהודית", "תורה", "מחשבה יהודית"]
}Error Response (400 Bad Request):
{
"success": false,
"error": "Failed to process YouTube video analysis",
"message": "YouTube URL is required and must be a non-empty string"
}Error Response (500 Internal Server Error):
{
"success": false,
"error": "Failed to process YouTube video analysis",
"message": "Failed to process YouTube video analysis request"
}success: Boolean indicating if the request was processed successfullydescription: Description of the video content in Hebrewcategories: Array of category names that best match the video content (maximum 3)error: Error type/category (only in error responses)message: Detailed error message (only in error responses)
Endpoint: GET /docs
Purpose: Provides an interactive web interface for exploring and testing the API using Scalar UI.
Method: GET
No request body required
Browser Access:
http://localhost:4000/docs
- Interactive API documentation
- Try-it functionality for testing endpoints
- Schema visualization
- Example payloads and responses
- Real-time API testing
Endpoint: GET /docs/json
Purpose: Returns the raw OpenAPI 3.0 specification in JSON format.
Method: GET
No request body required
Access URL:
http://localhost:4000/docs/json
Returns a complete OpenAPI 3.0 specification JSON document containing:
- API metadata
- Server information
- Endpoint definitions
- Request/response schemas
- Authentication requirements
cURL:
curl -X POST http://localhost:4000/analyzeYouTubeVideo \
-H "Content-Type: application/json" \
-d '{
"youtubeUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"categories": ["פילוסופיה יהודית", "תורה", "חסידות", "קבלה", "מחשבה יהודית"]
}'Expected Response (4-5 sentences in Hebrew):
{
"success": true,
"description": "השיעור עוסק בבחירה החופשית במחשבה היהודית. הוא בוחן את קיומה של הבחירה החופשית ואת הגורמים המשפיעים עליה. הנושא נדון מתוך התייחסות למקורות קלאסיים ביהדות. השיעור מציע ניתוח פילוסופי-תיאולוגי מעמיק. הוא מתמקד בשאלות יסוד הנוגעות ליחסים בין רצון האדם לרצון שמיים.",
"categories": ["פילוסופיה יהודית", "מחשבה יהודית"]
}Note: The description will be exactly 4-5 sentences in Hebrew. Categories will only include items from your provided list.
cURL:
curl -X POST http://localhost:4000/identifyCategories \
-H "Content-Type: application/json" \
-d '{
"categories": ["Technology", "Science", "Business", "Health", "Education"],
"paragraph": "The rapid advancement in artificial intelligence and machine learning is transforming how businesses operate globally."
}'Expected Response:
{
"success": true,
"matchingCategories": ["Technology", "Business"],
"totalCategoriesProvided": 5
}cURL:
curl -X POST http://localhost:4000/identifyCategories \
-H "Content-Type: application/json" \
-d '{
"categories": ["Sports", "Politics", "Technology", "Entertainment", "Science"],
"paragraph": "The new smartphone features cutting-edge AI capabilities and revolutionary camera technology that will change mobile photography forever."
}'Expected Response:
{
"success": true,
"matchingCategories": ["Technology"],
"totalCategoriesProvided": 5
}cURL:
curl -X POST http://localhost:4000/identifyCategories \
-H "Content-Type: application/json" \
-d '{
"categories": [],
"paragraph": "This is a test paragraph."
}'Expected Response:
{
"success": false,
"error": "Failed to process category identification",
"message": "Categories array is required and must not be empty"
}cURL:
curl -X POST http://localhost:4000/identifyCategories \
-H "Content-Type: application/json" \
-d '{
"categories": ["Technology", "Science"],
"paragraph": ""
}'Expected Response:
{
"success": false,
"error": "Failed to process category identification",
"message": "Paragraph is required and must be a non-empty string"
}async function identifyCategories(categories, paragraph) {
const response = await fetch('http://localhost:4000/identifyCategories', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
categories,
paragraph
})
});
const result = await response.json();
return result;
}
// Usage
identifyCategories(
['Technology', 'Science', 'Business'],
'AI and machine learning are revolutionizing business processes.'
).then(console.log);const axios = require('axios');
async function identifyCategories(categories, paragraph) {
try {
const response = await axios.post('http://localhost:4000/identifyCategories', {
categories,
paragraph
});
console.log('Success:', response.data);
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
}const fetch = require('node-fetch');
async function identifyCategories(categories, paragraph) {
const response = await fetch('http://localhost:4000/identifyCategories', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
categories,
paragraph
})
});
const data = await response.json();
return data;
}import requests
import json
def identify_categories(categories, paragraph):
url = 'http://localhost:4000/identifyCategories'
payload = {
'categories': categories,
'paragraph': paragraph
}
try:
response = requests.post(url, json=payload)
return response.json()
except requests.exceptions.RequestException as e:
print(f"Error: {e}")
return None
# Usage
result = identify_categories(
['Technology', 'Science', 'Business'],
'AI and machine learning are transforming business processes worldwide.'
)
print(result)import httpx
import asyncio
async def identify_categories(categories, paragraph):
async with httpx.AsyncClient() as client:
response = await client.post(
'http://localhost:4000/identifyCategories',
json={
'categories': categories,
'paragraph': paragraph
}
)
return response.json()
# Usage
result = asyncio.run(identify_categories(
['Technology', 'Science', 'Business'],
'The latest developments in quantum computing are revolutionary.'
))
print(result)-
Invalid API Key: When GOOGLE_API_KEY is not properly configured
{ "success": false, "error": "Failed to process category identification", "message": "Failed to process category identification request" } -
Invalid Input: Missing or empty required fields
{ "success": false, "error": "Failed to process category identification", "message": "Categories array is required and must not be empty" } -
Network Issues: Connectivity problems with Gemini AI service
{ "success": false, "error": "Failed to process category identification", "message": "Failed to process category identification request" }
- 200: Success - Categories identified successfully
- 400: Bad Request - Invalid input parameters
- 500: Internal Server Error - Server or AI service error
- Category Selection: Provide relevant categories that could realistically match your content
- Text Quality: Ensure paragraphs contain substantial, meaningful content for better AI analysis
- Error Handling: Always check the
successfield in responses - Rate Limiting: Consider implementing appropriate delays between requests
- Input Validation: Validate your inputs before sending to avoid unnecessary API calls
- The API uses Google's Gemini AI service which has its own rate limits
- Consider implementing client-side caching for frequently analyzed content
- Monitor your usage through Google's AI Studio dashboard
For issues or questions:
- Check the interactive documentation at
/docs - Review the OpenAPI specification at
/docs/json - Ensure your GOOGLE_API_KEY is properly configured in the
.envfile