Integrating AI Think API into Your Applications
Overview
AI Think provides a powerful REST API that allows developers to integrate AI image generation capabilities into their applications, websites, and services.
API Endpoints
Authentication
All API requests require authentication using your API key:
curl -H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
https://api.aithink.app/v1/generate
Generate Image
{
"prompt": "a beautiful sunset over mountains",
"style": "photorealistic",
"resolution": "1024x1024",
"num_images": 1
}
Response Format
{
"success": true,
"data": {
"images": [
{
"url": "https://cdn.aithink.app/images/abc123.jpg",
"id": "img_123456",
"created_at": "2024-01-15T10:30:00Z"
}
],
"credits_used": 1
}
}
SDK Examples
JavaScript/Node.js
import { AITink } from 'aithink-sdk';
const client = new AITink('your-api-key');
const result = await client.generate({
prompt: 'a futuristic city at night',
style: 'cyberpunk',
resolution: '1024x1024'
});
console.log(result.images[0].url);
Python
import aithink
client = aithink.Client('your-api-key')
result = client.generate(
prompt='a serene lake with mountains',
style='photorealistic',
resolution='1024x1024'
)
print(result.images[0].url)
Rate Limits
- Free Tier: 10 requests per minute
- Pro Tier: 100 requests per minute
- Enterprise: Custom limits available
Best Practices
- Cache Results: Store generated images to avoid regenerating
- Batch Requests: Combine multiple prompts when possible
- Error Handling: Implement proper error handling and retries
- Credit Management: Monitor your credit usage
Use Cases
- Content Management Systems: Auto-generate featured images
- E-commerce: Product visualization
- Social Media: Automated post creation
- Gaming: Asset generation
- Marketing: Campaign visuals
Support
For API support and documentation, visit our Developer Portal or contact us at api@aithink.app.