AI Tool Nest API

AI Tool Nest is a powerful, production-ready REST API service that provides advanced AI-powered text and image processing capabilities. Built with FastAPI and modern Python, it offers enterprise-grade features including robust authentication, rate limiting, and comprehensive monitoring.

Key Features

  • • Advanced text summarization with customizable parameters
  • • Context-aware text paraphrasing with style options
  • • Image-to-text conversion with OCR capabilities
  • • Dual authentication system (JWT & API Keys)
  • • Comprehensive usage analytics

Technical Highlights

  • • Built on FastAPI for maximum performance
  • • Async database operations with PostgreSQL
  • • Granular rate limiting per endpoint
  • • Structured JSON logging with rotation

Getting Started

To start using the API, you'll need to:

  1. Register for an account using the authentication endpoint
  2. Generate an API key for secure access
  3. Include your API key in request headers
  4. Start making requests to our endpoints

API Documentation

Below you'll find comprehensive examples for all available endpoints. Each example is standalone and can be run directly.

Authentication

Health Check

Check the API's health status.

Rate Limit: 5 requests per minute

import requests

url = 'https://thisisaqib.com/ai-tool-nest-api/v1/endpoints/health'
response = requests.get(url)
print(response.json())

# Example Response:
# {
#     'status': 'healthy'
# }

User Registration

Register a new user account.

Rate Limit: 5 requests per minute

import requests

url = 'https://thisisaqib.com/ai-tool-nest-api/v1/endpoints/auth/register'
payload = {
    'username': 'your_username',
    'email': 'your_email@example.com',
    'password': 'your_secure_password'
}

response = requests.post(url, json=payload)
print(response.json())

# Example Response:
# {
#     'email': 'your_email@example.com',
#     'username': 'your_username',
#     'id': 5,
#     'is_active': True
# }

User Login

Get an access token for authentication.

Rate Limit: 5 requests per minute

import requests

url = 'https://thisisaqib.com/ai-tool-nest-api/v1/endpoints/auth/login'
payload = {
    'username': 'your_username',
    'password': 'your_secure_password'
}

response = requests.post(url, json=payload)
print(response.json())

# Example Response:
# {
#     'access_token': 'your-jwt-token',
#     'token_type': 'bearer'
# }

# Store the access token for later use
access_token = response.json()['access_token']

API Key Management

Create API Key

Generate a new API key for accessing protected endpoints.

Rate Limit: 2 requests per minute

import requests

url = 'https://thisisaqib.com/ai-tool-nest-api/v1/endpoints/api-keys'
headers = {
    'Authorization': f'Bearer {access_token}'  # Use access_token from login
}
payload = {
    'name': 'my_api_key'
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())

# Example Response:
# {
#     'id': 2,
#     'name': 'my_api_key',
#     'key_prefix': '_66EFEuo',
#     'status': 'active',
#     'created_at': '2025-04-24T10:25:57.538980',
#     'last_used_at': None,
#     'revoked_at': None,
#     'api_key': '_66EFEuoiT-hqBx43y0bGKTcDUnHQL107MSkZ9k91A4'
# }

# Store the API key for later use
api_key = response.json()['api_key']

List API Keys

View all your active API keys.

Rate Limit: 10 requests per minute

import requests

url = 'https://thisisaqib.com/ai-tool-nest-api/v1/endpoints/api-keys'
headers = {
    'Authorization': f'Bearer {access_token}'  # Use access_token from login
}

response = requests.get(url, headers=headers)
api_keys = response.json()['api_keys']

# Print API keys in a readable format
print(f"Total API keys: {len(api_keys)}")
for key in api_keys:
    print(
        f"ID: {key['id']} || "
        f"Name: {key['name']} || "
        f"Key Prefix: {key['key_prefix']} || "
        f"Status: {key['status']} || "
        f"Created at: {key['created_at']} || "
        f"Last Used at: {key['last_used_at']}"
    )

Get API Key Usage

Check usage statistics for a specific API key.

Rate Limit: 10 requests per minute

import requests

api_key_id = 123  # Replace with your API key ID
url = f'https://thisisaqib.com/ai-tool-nest-api/v1/endpoints/api-keys/{api_key_id}/usage'
headers = {
    'Authorization': f'Bearer {access_token}'  # Use access_token from login
}

response = requests.get(url, headers=headers)
print(response.json())

Delete API Key

Revoke an existing API key.

Rate Limit: 2 requests per minute

import requests

api_key_id = 123  # Replace with the API key ID you want to delete
url = f'https://thisisaqib.com/ai-tool-nest-api/v1/endpoints/api-keys/{api_key_id}'
headers = {
    'Authorization': f'Bearer {access_token}'  # Use access_token from login
}

response = requests.delete(url, headers=headers)
print(response.json())

AI Tools

Text Summarization

Generate a concise summary of provided text.

Rate Limit: 5 requests per minute

import requests

url = 'https://thisisaqib.com/ai-tool-nest-api/v1/endpoints/ai-tools/summarize'
headers = {
    'X-API-Key': api_key  # Use api_key from the create API key response
}
payload = {
    'text': '''A Python developer is needed to join an AI project focusing on building an intelligent 
    chatbot and AI agent. The ideal candidate should have strong Python proficiency, experience 
    integrating AI/ML services and APIs, and good communication skills in English. Experience in 
    Python web frameworks, vector databases, SQL databases, asynchronous programming, and Docker 
    is also required.''',
    'include_keywords': True
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())

Text Paraphrasing

Rewrite text in different styles.

Rate Limit: 5 requests per minute

import requests

url = 'https://thisisaqib.com/ai-tool-nest-api/v1/endpoints/ai-tools/paraphrase'
headers = {
    'X-API-Key': api_key  # Use api_key from the create API key response
}
payload = {
    'text': '''A Python developer is needed to join an AI project focusing on building an intelligent 
    chatbot and AI agent. The ideal candidate should have strong Python proficiency, experience 
    integrating AI/ML services and APIs, and good communication skills in English.''',
    'style': 'formal',
    'intensity': 'high',
    'length_option': 'longer'
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())

Image to Text

Convert images to text using URL or file upload.

Rate Limit: 5 requests per minute

import requests

# Using Image URL
url = 'https://thisisaqib.com/ai-tool-nest-api/v1/endpoints/ai-tools/image-to-text'
headers = {
    'X-API-Key': api_key  # Use api_key from the create API key response
}
payload = {
    'image_url': 'https://example.com/path/to/your/image.jpg',
    'mode': 'ocr',
    'detail_level': 'standard'
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())

# Using Image File
file_path = 'path/to/your/image.jpg'  # Replace with your image path
with open(file_path, 'rb') as file:
    files = {'image_file': (file_path, file, 'image/jpeg')}
    response = requests.post(url, files=files, headers=headers, data=payload)
    print(response.json())

Error Handling

Here's how to handle errors when making API requests:

import requests

try:
    # Make your API request here
    response = requests.post(url, json=payload, headers=headers)
    response.raise_for_status()  # Raises an error for bad status codes
    result = response.json()
    print("Success:", result)
    
except requests.exceptions.RequestException as e:
    if hasattr(e.response, 'json'):
        error_detail = e.response.json()
        print(f"API Error: {error_detail}")
    else:
        print(f"Request Error: {str(e)}")
        
except Exception as e:
    print(f"Unexpected Error: {str(e)}")