Skip to content

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:

ParameterTypeRequiredDescription
documentBase64StringYesBase64 encoded document
fileTypeStringYesFile type: docx, pptx, xlsx, pdf, txt
sourceLangStringNoSource language (auto-detect)
targetLangStringYesTarget language code
preserveFormattingBooleanNoPreserve document formatting (default: true)

Request:

bash
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:

json
{
  "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:

ParameterTypeRequiredDescription
textStringYesText to summarize
maxLengthIntegerNoMaximum summary length (default: 150)
minLengthIntegerNoMinimum summary length (default: 40)
styleStringNoSummary style: bullet, paragraph (default: paragraph)

Request:

bash
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:

json
{
  "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:

ParameterTypeRequiredDescription
textStringYesText to analyze
languageStringNoLanguage code (auto-detect)

Request:

bash
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:

json
{
  "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:

ParameterTypeRequiredDescription
textStringYesInput text
entitiesArrayNoSpecific entities to extract (default: all)

Request:

bash
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:

json
{
  "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
}

Generate QR codes with embedded logos and customization.

Endpoint: POST /ai/qrcode/custom

Parameters:

ParameterTypeRequiredDescription
dataStringYesData to encode
sizeIntegerNoQR size (default: 300)
logoBase64StringNoBase64 encoded logo image
foregroundColorStringNoHex color (default: #000000)
backgroundColorStringNoHex color (default: #FFFFFF)
errorCorrectionStringNoError correction level (default: H)

Request:

bash
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:

json
{
  "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:

ParameterTypeRequiredDescription
textStringYesText to analyze

Request:

bash
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:

json
{
  "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:

ParameterTypeRequiredDescription
textStringYesText to classify
classifierStringYesClassifier type: spam, sentiment, topic, intent
categoriesArrayNoCustom categories (for custom classifiers)

Request:

bash
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:

json
{
  "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:

ParameterTypeRequiredDescription
textStringYesInput text
maxKeywordsIntegerNoMaximum keywords (default: 10)
includePhrasesBooleanNoInclude multi-word phrases (default: true)

Request:

bash
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:

json
{
  "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

TypeDescription
PERSONPeople names
ORGANIZATIONCompanies, institutions
LOCATIONCities, countries, addresses
DATEDates and time periods
MONEYMonetary values
PERCENTPercentage values
EMAILEmail addresses
PHONEPhone 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