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.
POST /api/rest/chat
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/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.
POST /api/rest/generate-image
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/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.
POST /api/rest/generate-video
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/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.
POST /api/rest/book-grading
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/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.
POST /api/rest/edufi-tools/tutor-agent
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/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.
POST /api/rest/detection-tools/deepfake
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
{
"imageUrl": "https://example.com/image.jpg",
"sensitivity": "high"
}
Credit Cost: 0.2 credits per detection
Explicit Content Detection
Screen images for inappropriate content.
POST /api/rest/detection-tools/explicit-content
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/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.
POST /api/rest/detection-tools/label
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/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.
POST /api/rest/detection-tools/logo
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/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.
POST /api/rest/writing-tools/ai-detection
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
{
"text": "Text to analyze for AI generation...",
"model": "advanced"
}
Credit Cost: 0.2 credits per analysis
Grammar Checker
Advanced grammar and style checking.
POST /api/rest/writing-tools/grammar-checker
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/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.
POST /api/rest/writing-tools/rephrase
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/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.
POST /api/rest/writing-tools/summarize
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/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.
POST /api/rest/blockchain-tools/audit
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/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.
POST /api/rest/blockchain-tools/contract-coder
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/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.
POST /api/rest/blockchain-tools/launch-adviser
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
{
"projectType": "DeFi",
"stage": "pre-launch",
"budget": "medium"
}
Credit Cost: 0.5 credits per consultation
Marketing Advisor
AI-powered marketing strategies for blockchain projects.
POST /api/rest/blockchain-tools/marketing-adviser
Authorization: Bearer inspira_your_api_key_here
Content-Type: application/json
{
"projectName": "MyDeFi Protocol",
"targetAudience": "DeFi enthusiasts",
"budget": "$50,000"
}
Credit Cost: 0.5 credits per strategy
Response Formats
Success Response
{
"success": true,
"data": {
// Service-specific response data
},
"creditsUsed": 1.5,
"timestamp": "2025-01-06T12:00:00.000Z"
}
Error Response
{
"success": false,
"error": {
"code": "INVALID_PARAMETER",
"message": "Image URL is required",
"field": "imageUrl"
}
}
Common Parameters
Image Services
Parameter | Type | Description | Default |
---|---|---|---|
quality | string | Output quality: low, medium, high | medium |
format | string | Image format: png, jpg, webp | png |
optimize | boolean | Optimize for file size | false |
Text Services
Parameter | Type | Description | Default |
---|---|---|---|
language | string | Language code (ISO 639-1) | en |
maxLength | number | Maximum output length | varies |
format | string | Output format: plain, markdown, html | plain |
Rate Limits
Service-specific rate limits:
Service | Requests/Minute | Concurrent |
---|---|---|
Chat API | 60 | 5 |
Image Generation | 20 | 2 |
Video Generation | 5 | 1 |
Detection Tools | 100 | 10 |
Writing Tools | 100 | 10 |
Blockchain Tools | 30 | 3 |
Best Practices
1. Batch Processing
When possible, batch similar requests:
// Instead of multiple individual requests
const results = await Promise.all(
images.map(img => detectLabels(img))
);
2. Error Handling
Implement robust error handling:
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:
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
Service | Maximum Input | Maximum Output |
---|---|---|
Chat | 4,000 tokens | 4,000 tokens |
Image Generation | 1,000 characters | 4096x4096 pixels |
Video Generation | 500 characters | 30 seconds |
Text Analysis | 50,000 characters | N/A |
Contract Audit | 10,000 lines | N/A |
File Size Limits
- Image uploads: 10MB
- Video processing: 100MB
- Document analysis: 5MB