Skip to content

AI Services API

Comprehensive documentation for all AI service endpoints.

Overview

Inspira provides a suite of AI-powered services accessible through our REST API. Each service is optimized for specific use cases and offers customizable parameters.

Available Services

Content Generation

Chat API

Generate conversational AI responses with context awareness.

http
POST /api/rest/chat
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
json
{
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Explain quantum computing"}
  ],
  "temperature": 0.7,
  "maxTokens": 1000
}

Credit Cost: 0.06 credits per 1,000 tokens

Image Generation

Create AI-generated images from text descriptions.

http
POST /api/rest/generate-image
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
json
{
  "prompt": "A futuristic city at sunset, cyberpunk style",
  "size": "1024x1024",
  "quality": "high",
  "style": "photorealistic"
}

Credit Cost: 1.5 credits per image

Video Generation

Generate short video clips from text prompts.

http
POST /api/rest/generate-video
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
json
{
  "prompt": "A spaceship landing on Mars",
  "duration": 5,
  "resolution": "1080p",
  "fps": 30
}

Credit Cost: 7.5 credits per video

Educational Tools

Book Grading

AI-powered analysis and grading of written content.

http
POST /api/rest/book-grading
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
json
{
  "content": "Essay text to be graded...",
  "gradeLevel": "high school",
  "subject": "english",
  "rubric": {
    "grammar": 25,
    "content": 40,
    "structure": 20,
    "creativity": 15
  }
}

Credit Cost: 3.0 credits per grading

EduFi Tutoring

AI tutoring across multiple educational systems.

http
POST /api/rest/edufi-tools/tutor-agent
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
json
{
  "message": "Explain the Krebs cycle",
  "subject": "biology",
  "level": "AP",
  "conversationHistory": []
}

Credit Cost: 10 credits per session

Detection Tools

Deepfake Detection

Identify AI-generated or manipulated images.

http
POST /api/rest/detection-tools/deepfake
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
json
{
  "imageUrl": "https://example.com/image.jpg",
  "sensitivity": "high"
}

Credit Cost: 0.2 credits per detection

Explicit Content Detection

Screen images for inappropriate content.

http
POST /api/rest/detection-tools/explicit-content
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
json
{
  "imageUrl": "https://example.com/image.jpg",
  "categories": ["violence", "adult", "gore"]
}

Credit Cost: 0.15 credits per scan

Label Detection

Identify objects and labels in images.

http
POST /api/rest/detection-tools/label
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
json
{
  "imageUrl": "https://example.com/image.jpg",
  "maxLabels": 10,
  "minConfidence": 0.7
}

Credit Cost: 0.15 credits per detection

Logo Detection

Detect brand logos and trademarks in images.

http
POST /api/rest/detection-tools/logo
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
json
{
  "imageUrl": "https://example.com/image.jpg",
  "brands": ["Nike", "Adidas", "Apple"]
}

Credit Cost: 0.2 credits per detection

Writing Tools

AI Detection

Check if text was generated by AI.

http
POST /api/rest/writing-tools/ai-detection
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
json
{
  "text": "Text to analyze for AI generation...",
  "model": "advanced"
}

Credit Cost: 0.2 credits per analysis

Grammar Checker

Advanced grammar and style checking.

http
POST /api/rest/writing-tools/grammar-checker
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
json
{
  "text": "Text to check for grammar errors...",
  "language": "en",
  "style": "formal"
}

Credit Cost: 0.2 credits per check

Text Rephrasing

Rewrite text while maintaining meaning.

http
POST /api/rest/writing-tools/rephrase
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
json
{
  "text": "Original text to rephrase...",
  "tone": "professional",
  "length": "similar"
}

Credit Cost: 0.3 credits per rephrase

Text Summarization

Create concise summaries of longer texts.

http
POST /api/rest/writing-tools/summarize
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
json
{
  "text": "Long article or document text...",
  "length": "medium",
  "format": "bullet_points"
}

Credit Cost: 0.5 credits per summary

Blockchain Tools

Smart Contract Audit

AI-powered security analysis of smart contracts.

http
POST /api/rest/blockchain-tools/audit
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
json
{
  "contractCode": "pragma solidity ^0.8.0;...",
  "blockchain": "ethereum",
  "auditLevel": "comprehensive"
}

Credit Cost: 2.0 credits per audit

Contract Code Generator

Generate smart contract code from specifications.

http
POST /api/rest/blockchain-tools/contract-coder
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
json
{
  "description": "ERC-20 token with burn function",
  "blockchain": "ethereum",
  "features": ["mintable", "burnable", "pausable"]
}

Credit Cost: 1.0 credits per generation

Launch Advisor

Get AI guidance for blockchain project launches.

http
POST /api/rest/blockchain-tools/launch-adviser
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
json
{
  "projectType": "DeFi",
  "stage": "pre-launch",
  "budget": "medium"
}

Credit Cost: 0.5 credits per consultation

Marketing Advisor

AI-powered marketing strategies for blockchain projects.

http
POST /api/rest/blockchain-tools/marketing-adviser
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
json
{
  "projectName": "MyDeFi Protocol",
  "targetAudience": "DeFi enthusiasts",
  "budget": "$50,000"
}

Credit Cost: 0.5 credits per strategy

Response Formats

Success Response

json
{
  "success": true,
  "data": {
    // Service-specific response data
  },
  "creditsUsed": 1.5,
  "timestamp": "2025-01-06T12:00:00.000Z"
}

Error Response

json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMETER",
    "message": "Image URL is required",
    "field": "imageUrl"
  }
}

Common Parameters

Image Services

ParameterTypeDescriptionDefault
qualitystringOutput quality: low, medium, highmedium
formatstringImage format: png, jpg, webppng
optimizebooleanOptimize for file sizefalse

Text Services

ParameterTypeDescriptionDefault
languagestringLanguage code (ISO 639-1)en
maxLengthnumberMaximum output lengthvaries
formatstringOutput format: plain, markdown, htmlplain

Rate Limits

Service-specific rate limits:

ServiceRequests/MinuteConcurrent
Chat API605
Image Generation202
Video Generation51
Detection Tools10010
Writing Tools10010
Blockchain Tools303

Best Practices

1. Batch Processing

When possible, batch similar requests:

javascript
// Instead of multiple individual requests
const results = await Promise.all(
  images.map(img => detectLabels(img))
);

2. Error Handling

Implement robust error handling:

javascript
try {
  const result = await generateImage(prompt);
  // Handle success
} catch (error) {
  if (error.code === 'INSUFFICIENT_CREDITS') {
    // Prompt user to purchase credits
  } else if (error.code === 'RATE_LIMIT') {
    // Implement exponential backoff
  }
}

3. Caching

Cache results when appropriate:

javascript
const cache = new Map();

async function getCachedOrGenerate(prompt) {
  const cached = cache.get(prompt);
  if (cached) return cached;
  
  const result = await generateImage(prompt);
  cache.set(prompt, result);
  return result;
}

Service Limits

Content Limits

ServiceMaximum InputMaximum Output
Chat4,000 tokens4,000 tokens
Image Generation1,000 characters4096x4096 pixels
Video Generation500 characters30 seconds
Text Analysis50,000 charactersN/A
Contract Audit10,000 linesN/A

File Size Limits

  • Image uploads: 10MB
  • Video processing: 100MB
  • Document analysis: 5MB

Next Steps

Revolutionizing Education with AI and Web3