Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Temicide/thcode/llms.txt

Use this file to discover all available pages before exploring further.

AI for Thai is thcode’s specialist-tool layer — a set of Thai-language AI services covering vision, speech, language, and address parsing. The AI for Thai credential is entirely separate from the Typhoon reasoning-provider key: you need one developer API key for reasoning (Typhoon) and a distinct developer API key for AI for Thai services. Both keys are stored locally and neither is ever sent to a hosted thcode proxy.

Credential Separation

thcode enforces strict isolation between its two Phase-1 credentials:

Typhoon key

Required for all reasoning turns. Stored under credential id "typhoon". Sent only to api.opentyphoon.ai. Never used for AI for Thai endpoints.

AI for Thai key

Optional in Phase 1; required once you use any specialist tool. Stored under credential id "aiforthai". Sent only to api.aiforthai.in.th. Never used for reasoning.
The hosted thcode service receives neither key. Provider requests originate directly from your machine.

Obtaining an AI for Thai Developer Key

AI for Thai developer API keys are available through the official developer registration at aiforthai.in.th. Register, select the services you want to access, and copy the API key to use during thcode onboarding.

Specialist Credential Onboarding

The AI for Thai credential is onboarded just-in-time: thcode pauses at the first request that requires a specialist tool and walks you through the credential form before the request is dispatched. No specialist tool is ever invoked without a stored, verified credential.
1

JIT pause at connection boundary

When a specialist tool is requested and no AI for Thai credential is configured, the onboarding flow starts immediately. The tool invocation is held — nothing is dispatched yet.
2

Disclosure

The CLI prints the complete disclosure before accepting any input:
AI-for-Thai is the shared credential group for four Specialist Services:
  - T-OCR (Thai Optical Character Recognition)
  - Speech-to-Text (Thai speech recognition)
  - Extract Address (Thai address extraction)
  - Named Entity Recognition (Thai NER)

Reviewed endpoint: https://api.aiforthai.in.th (called directly from this CLI; no hosted proxy).
Your API key is stored in the OS credential facility (Windows Credential Manager / macOS Keychain).
The key is never written to .env, project files, SQLite, journal, transcript, or output.
The key is shared by all four services and never reaches Typhoon, SCBx, or any hosted component.
You can remove or rotate the key at any time.
In headless (non-TTY) mode, the flow returns headless-blocked immediately — it never reads from stdin or auto-continues.
3

Masked key input

You paste your AI for Thai API key at a masked, non-echoing prompt. An empty submission cancels onboarding with a cancelled result and no credential is written.
4

Write to OS credential store

The key is stored under the single shared credential group id "aiforthai" via store.set('aiforthai', trimmedKey). All four launch services share this one credential entry.
5

Endpoint verification

The onboarding flow verifies the target origin — confirming TLS, no redirects accepted, and that the request is bound to api.aiforthai.in.th. If verification fails, the stored key is removed immediately and the result is unavailable.
6

Secret-free reference stored

Only a secret-free AiForThaiCredentialReference is persisted in product storage:
interface AiForThaiCredentialReference {
  readonly referenceId: string;         // e.g. "aiforthai-2026-07-12T..."
  readonly credentialRevision: string;  // changes on rotation
  readonly fingerprint: string;         // hash of identity + host + revision
  readonly storedAt: string;            // UTC ISO-8601
}
The raw key value never appears in this record or anywhere in product persistence.
7

Verify connection

Run /tools inspect <service-id> to confirm the credential reached available state for the specialist service you need.

Specialist Health Lifecycle

A stored AI for Thai credential does not automatically make services available. Each specialist service goes through the same generation-bound health lifecycle as reasoning providers:
A configured key alone is not sufficient to invoke a specialist service. An explicit health check must pass, consent must be given, and the service must have appropriate authority before any call is dispatched.
unconfigured → configured → checking → available
                                     ↘ unavailable
                                     ↘ unhealthy
                                     ↘ quarantined
StateMeaning
unconfiguredNo credential is stored; no configuration generation exists
configuredA credential is stored and a generation is registered, but no live check has run yet
availableThe live probe passed against the current generation
unavailableA transient (retryable) probe failure — connectivity, quota
unhealthyA fatal probe failure — auth rejected, configuration error, or protocol mismatch
quarantinedCredential was rejected; locked until an explicit retest passes
Removing or rotating the credential invalidates the current configuration generation. All dependent services return to unconfigured with no cached key value left in any buffer or persistence layer.

Catalogued Services

The AI for Thai service catalog uses explicit support levels. A service appearing in the catalog does not mean it can be called — it means it has been reviewed and listed.
Support levelWhat it means
cataloguedDiscoverable and inspectable; not claimed callable
integratedAdapter and contract implemented
verifiedContract tests passed against the live endpoint
demo-certifiedVerified and cleared for demonstration use

Phase-1 Catalogued Services

All four launch services are currently catalogued:

T-OCR

Thai text detection and recognition from images. Endpoint: https://api.aiforthai.in.th/ocr. Modality: image.

Speech-to-Text

Thai automatic speech recognition (audio to text). Endpoint: https://api.aiforthai.in.th/partii-webapi. Modality: audio.

Extract Address

Parse a Thai free-text address into structured components. Endpoint: https://api.aiforthai.in.th/textmedad. Modality: text.

Named Entity Recognition

Thai NER — people, places, and organizations. Endpoint: https://api.aiforthai.in.th/thainer. Modality: text.
A catalogued service is discoverable with /tools and inspectable, but it is not claimed callable. Until a service reaches verified support level, dispatching it may fail in ways that are not covered by thcode’s contract tests.

Credential Security Rules

The same security invariants that apply to the Typhoon key apply to the AI for Thai key, with one additional rule:
The AI for Thai key is sent exclusively to verified api.aiforthai.in.th endpoints. It never reaches Typhoon, SCBx, any hosted thcode component, or any third-party origin. Redirects are not followed — only the exact verified host is accepted.
The key never enters a reasoning turn as context. Recognized credential patterns are redacted from tool output before being passed to Typhoon.
When you run /disconnect aiforthai, the stored credential is deleted, all dependent configuration generations become stale, and all four specialist services return to unconfigured. No cached key value remains anywhere in the product.

Phase 2 Gateway

In Phase 2, once thcode is onboarded as an AI for Thai service, the AI for Thai API key is expected to become the primary platform credential that covers both the thcode service and permitted AI for Thai models and tools. The exact behavior — headers, endpoint routing, quota, and whether the gateway passes or strips the caller key — depends on confirmation from the AI for Thai organizers and is not yet implemented. No Phase 2 gateway behavior is assumed in the current release.
Use /tools inspect <service-id> at any time to see the current health state, generation id, and endpoint for a specific AI for Thai service — without exposing the key value.

Build docs developers (and LLMs) love