Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	metadata
			title: LLM AI Agent API
emoji: π€
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860
pinned: false
license: mit
LLM AI Agent API
A secure, production-ready AI agent API powered by local LLM deployment on Hugging Face Spaces.
π Quick Start
- Set Environment Variables in your Space settings: - API_KEY_1: Your secure API key
- API_KEY_2: Additional API key (optional)
- MODEL_NAME: LLM model to use (default: microsoft/DialoGPT-medium)
 
- Access your API at: - https://your-username-your-space.hf.space
- Test the API: 
curl -X POST "https://your-space-url.hf.space/chat" \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"message": "Hello, how are you?"}'
π Documentation
- API Docs: /docs(Interactive Swagger UI)
- Health Check: /health
- Model Info: /models(requires authentication)
π Security Features
- API key authentication
- Rate limiting (10 requests/minute per key)
- CORS support
- Request logging
π οΈ Integration
See client_examples.py and client_examples.js for integration examples in Python and JavaScript.
π API Reference
POST /chat
{
  "message": "Your input message",
  "max_length": 200,
  "temperature": 0.7,
  "system_prompt": "Optional system prompt"
}
Response:
{
  "response": "AI response",
  "model_used": "microsoft/DialoGPT-medium",
  "timestamp": "2024-01-01T12:00:00",
  "tokens_used": 45,
  "processing_time": 1.23
}
π§ Configuration
Set these environment variables in your Space:
- API_KEY_1,- API_KEY_2: Authentication keys
- MODEL_NAME: Hugging Face model ID
- MAX_LENGTH: Maximum response length
- TEMPERATURE: Response creativity (0.1-2.0)
- RATE_LIMIT: Requests per minute per key
π License
MIT License - see LICENSE file for details.
