AI For Thai API

Machine Learning / API Key Intermediate HTTPS CORS
Varies by plan (check documentation)

Overview

AI For Thai is a free collection of AI-powered APIs specifically designed for the Thai language, covering NLP tasks like word segmentation, sentiment analysis, and text-to-speech. It is built to address the unique challenges of processing Thai text, which has no spaces between words. An API key from the NECTEC research institute is required to access the service.

💡

Beginner Tip

Thai text processing requires special tokenization because Thai words are not separated by spaces—always send raw Thai text and let the API handle segmentation. Register at aiforthai.in.th with a Thai ID or institutional account to receive your API key.

Available Data

Use case: Integrate free various thai ai api data into web and mobile applications
AI For Thai data via REST API
JSON-formatted response data
Requires API key authentication

Example Response

JSON Response
{
  "status": "success",
  "data": {
    "result": "Data from AI For Thai",
    "description": "Free Various Thai AI API",
    "timestamp": "2025-01-15T10:00:00Z"
  }
}

Field Reference

tokens List of word tokens resulting from Thai word segmentation.
tokens[].data The individual Thai word extracted by the tokenizer.
tokens[].type Token type such as WORD, PUNCT, or SPACE.

Implementation Example

const url = "https://aiforthai.in.th/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

401 Unauthorized Missing or incorrect API key in the request header.
Include the apikey header with your NECTEC-issued API key in every request.
Incorrect segmentation Input text contains mixed Thai and English without proper formatting.
Send clean Thai-only text for word segmentation; preprocess to remove HTML tags or special characters first.
Connection timeout The server may be under maintenance or experiencing high load.
Retry after a short delay; check the AI For Thai website for service status announcements.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 10/20
🔒 Security 15/15
🛠 Developer XP 17/20
✓ Reliability 10/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS YES
Category Machine Learning
Difficulty Intermediate
Verified: 2026-04-04

Similar APIs

View All →