AI Services API
Overview
The AI Services API provides intelligent document processing, translation, QR code generation, and machine learning utilities.
Base Endpoint: /ai
API Endpoints
1. Document Translation
Translate entire documents while preserving formatting.
Endpoint: POST /ai/translate/document
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| documentBase64 | String | Yes | Base64 encoded document |
| fileType | String | Yes | File type: docx, pptx, xlsx, pdf, txt |
| sourceLang | String | No | Source language (auto-detect) |
| targetLang | String | Yes | Target language code |
| preserveFormatting | Boolean | No | Preserve document formatting (default: true) |
Request:
curl -X POST "https://api.alaikis.com/std/ai/translate/document" \
-H "X-API-Key: your_api_key" \
-H "X-API-Secret: your_api_secret" \
-d "bizContent={\"documentBase64\": \"TG9yZW0gaXBzdW0uLi4=\", \"fileType\": \"docx\", \"targetLang\": \"zh\"}"Response:
{
"code": 200,
"msg": "Request successful",
"data": {
"translatedDocumentBase64": "5bCP5paZ5paH5pysLi4=",
"originalFileType": "docx",
"sourceLang": "en",
"targetLang": "zh",
"characterCount": 1542,
"processingTimeMs": 2340
},
"timestamp": 1715385600
}2. Text Summarization
Generate concise summaries of long text documents.
Endpoint: POST /ai/summarize
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | String | Yes | Text to summarize |
| maxLength | Integer | No | Maximum summary length (default: 150) |
| minLength | Integer | No | Minimum summary length (default: 40) |
| style | String | No | Summary style: bullet, paragraph (default: paragraph) |
Request:
curl -X POST "https://api.alaikis.com/std/ai/summarize" \
-H "X-API-Key: your_api_key" \
-H "X-API-Secret: your_api_secret" \
-d "bizContent={\"text\": \"Very long article text...\", \"maxLength\": 200, \"style\": \"bullet\"}"Response:
{
"code": 200,
"msg": "Request successful",
"data": {
"summary": [
"Key point 1 extracted from text",
"Key point 2 extracted from text",
"Key point 3 extracted from text"
],
"originalLength": 2450,
"summaryLength": 180,
"compressionRatio": 0.93
},
"timestamp": 1715385600
}3. Sentiment Analysis
Analyze emotional tone and sentiment of text.
Endpoint: POST /ai/sentiment
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | String | Yes | Text to analyze |
| language | String | No | Language code (auto-detect) |
Request:
curl -X POST "https://api.alaikis.com/std/ai/sentiment" \
-H "X-API-Key: your_api_key" \
-H "X-API-Secret: your_api_secret" \
-d "bizContent={\"text\": \"The product quality exceeded my expectations!\"}"Response:
{
"code": 200,
"msg": "Request successful",
"data": {
"overallSentiment": "positive",
"confidence": 0.94,
"scores": {
"positive": 0.94,
"neutral": 0.05,
"negative": 0.01
},
"emotions": {
"joy": 0.88,
"surprise": 0.42,
"trust": 0.76
},
"language": "en"
},
"timestamp": 1715385600
}4. Named Entity Recognition (NER)
Extract entities like names, organizations, locations from text.
Endpoint: POST /ai/ner
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | String | Yes | Input text |
| entities | Array | No | Specific entities to extract (default: all) |
Request:
curl -X POST "https://api.alaikis.com/std/ai/ner" \
-H "X-API-Key: your_api_key" \
-H "X-API-Secret: your_api_secret" \
-d "bizContent={\"text\": \"Apple Inc. was founded by Steve Jobs in Cupertino, California.\"}"Response:
{
"code": 200,
"msg": "Request successful",
"data": {
"entities": [
{
"text": "Apple Inc.",
"type": "ORGANIZATION",
"startOffset": 0,
"endOffset": 10,
"confidence": 0.99
},
{
"text": "Steve Jobs",
"type": "PERSON",
"startOffset": 26,
"endOffset": 36,
"confidence": 0.98
},
{
"text": "Cupertino",
"type": "LOCATION",
"startOffset": 40,
"endOffset": 50,
"confidence": 0.96
}
]
},
"timestamp": 1715385600
}5. QR Code with Logo
Generate QR codes with embedded logos and customization.
Endpoint: POST /ai/qrcode/custom
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| data | String | Yes | Data to encode |
| size | Integer | No | QR size (default: 300) |
| logoBase64 | String | No | Base64 encoded logo image |
| foregroundColor | String | No | Hex color (default: #000000) |
| backgroundColor | String | No | Hex color (default: #FFFFFF) |
| errorCorrection | String | No | Error correction level (default: H) |
Request:
curl -X POST "https://api.alaikis.com/std/ai/qrcode/custom" \
-H "X-API-Key: your_api_key" \
-H "X-API-Secret: your_api_secret" \
-d "bizContent={\"data\": \"https://alaikis.com\", \"size\": 400, \"foregroundColor\": \"#1a73e8\"}"Response:
{
"code": 200,
"msg": "Request successful",
"data": {
"qrImageBase64": "iVBORw0KGgoAAAANSUhEUg...",
"mimeType": "image/png",
"width": 400,
"height": 400,
"errorCorrection": "H",
"encodedData": "https://alaikis.com"
},
"timestamp": 1715385600
}6. Language Detection
Detect the language of input text.
Endpoint: POST /ai/language/detect
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | String | Yes | Text to analyze |
Request:
curl -X POST "https://api.alaikis.com/std/ai/language/detect" \
-H "X-API-Key: your_api_key" \
-H "X-API-Secret: your_api_secret" \
-d "bizContent={\"text\": \"こんにちは世界\"}"Response:
{
"code": 200,
"msg": "Request successful",
"data": {
"detectedLanguage": "ja",
"languageName": "Japanese",
"confidence": 0.99,
"topCandidates": [
{"code": "ja", "name": "Japanese", "confidence": 0.99},
{"code": "zh", "name": "Chinese", "confidence": 0.01}
]
},
"timestamp": 1715385600
}7. Text Classification
Classify text into predefined categories.
Endpoint: POST /ai/classify
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | String | Yes | Text to classify |
| classifier | String | Yes | Classifier type: spam, sentiment, topic, intent |
| categories | Array | No | Custom categories (for custom classifiers) |
Request:
curl -X POST "https://api.alaikis.com/std/ai/classify" \
-H "X-API-Key: your_api_key" \
-H "X-API-Secret: your_api_secret" \
-d "bizContent={\"text\": \"Free money!!! Click here now!!!\", \"classifier\": \"spam\"}"Response:
{
"code": 200,
"msg": "Request successful",
"data": {
"classification": "spam",
"confidence": 0.97,
"scores": {
"spam": 0.97,
"ham": 0.03
},
"spamIndicators": ["Free money", "excessive punctuation", "urgent language"]
},
"timestamp": 1715385600
}8. Keyword Extraction
Extract important keywords and phrases from text.
Endpoint: POST /ai/keywords
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | String | Yes | Input text |
| maxKeywords | Integer | No | Maximum keywords (default: 10) |
| includePhrases | Boolean | No | Include multi-word phrases (default: true) |
Request:
curl -X POST "https://api.alaikis.com/std/ai/keywords" \
-H "X-API-Key: your_api_key" \
-H "X-API-Secret: your_api_secret" \
-d "bizContent={\"text\": \"Machine learning is a subset of artificial intelligence...\"}"Response:
{
"code": 200,
"msg": "Request successful",
"data": {
"keywords": [
{"term": "machine learning", "score": 0.95, "frequency": 3},
{"term": "artificial intelligence", "score": 0.89, "frequency": 2},
{"term": "neural networks", "score": 0.82, "frequency": 2}
]
},
"timestamp": 1715385600
}Supported Entity Types
| Type | Description |
|---|---|
| PERSON | People names |
| ORGANIZATION | Companies, institutions |
| LOCATION | Cities, countries, addresses |
| DATE | Dates and time periods |
| MONEY | Monetary values |
| PERCENT | Percentage values |
| Email addresses | |
| PHONE | Phone numbers |
Supported Languages
AI services support 50+ languages including:
- European: en, de, fr, es, it, pt, ru, nl, pl
- Asian: zh, ja, ko, th, vi, id, hi, ar
- Other: ar, he, tr, fa
Rate Limiting
- Document Translation: 50 documents/hour (10MB max)
- Text Processing: 10000 requests/hour
- QR Generation: 500 requests/hour
Support
Contact: support@alaikis.com