API Reference · API مەلۇماتنامىسى

UyghurAI API Reference

ئۇيغۇر AI API مەلۇماتنامىسى

The UyghurAI API is a REST API hosted at https://api.idirak.com/v1. It is fully compatible with the OpenAI API — so any library or tool that works with OpenAI will work with UyghurAI by changing the base URL and API key.

Chat

Streaming text completions

Images

Uyghur-aware image generation

Audio

Speech & Muqam transcription

Script

Arabic-script Uyghur correction

Auth

Bearer-token API keys

Models

8 specialized models

Authentication كىملىك دەلىللەش

All requests must include your API key in the Authorization header as a Bearer token. Get your key from the dashboard after signing up or joining the waitlist.

authentication.py
from openai import OpenAI

client = OpenAI(
    api_key="uai-your-key-here",
    base_url="https://api.idirak.com/v1",
)

response = client.chat.completions.create(
    model="taklimakan",
    messages=[{"role": "user", "content": "ياخشىمۇسىز؟"}],
)
print(response.choices[0].message.content)
API keys start with uai-. Never expose your key in client-side code — always call the API from your backend.

Chat completions سۆھبەت تاماملاش

Generate a model response for a given conversation. Supports streaming, system prompts, multi-turn context, and function calling.

endpoint
POST https://api.idirak.com/v1/chat/completions
ParameterTypeDescription
modelrequiredstringModel ID, e.g. taklimakan, kiroran, tarim.
messagesrequiredarrayArray of message objects with role and content.
streambooleanIf true, responses are streamed as SSE. Default: false.
max_tokensintegerMax tokens to generate. Default: model maximum.
temperaturenumberSampling temperature 0–2. Default: 1.
top_pnumberNucleus sampling probability. Default: 1.
toolsarrayFunction definitions for tool/function calling.
chat.py
# Streaming chat with Taklimakan
response = client.chat.completions.create(
    model="taklimakan",
    stream=True,
    messages=[
        {"role": "system", "content": "You are a helpful Uyghur-language assistant."},
        {"role": "user", "content": "ئۇيغۇر تارىخى ھەققىدە بىر پاراگراف يازىپ بەر."},
    ],
)
for chunk in response:
    print(chunk.choices[0].delta.content, end="", flush=True)

Image generation رەسىم ياساش

Generate images from a text prompt using the Atlas vision model. Supports Uyghur cultural motifs, calligraphy styles, and ikat textile patterns.

endpoint
POST https://api.idirak.com/v1/images/generate
ParameterTypeDescription
promptrequiredstringText description of the image to generate. Accepts Uyghur script.
modelstringMust be atlas. Default: atlas.
nintegerNumber of images to generate (1–4). Default: 1.
sizestringOutput dimensions: 512x512, 1024x1024, 1024x1792. Default: 1024x1024.
stylestringVisual style preset: cultural, modern, calligraphy, ikat.
response_formatstringurl or b64_json. Default: url.
images.py
response = client.images.generate(
    model="atlas",
    prompt="ئۇيغۇر ئىكات نەقىشى بىلەن بېزەلگەن ئالتۇن قاپقاق",
    n=1,
    size="1024x1024",
    extra_body={"style": "ikat"},
)
print(response.data[0].url)

Audio & speech ئاۋاز ۋە نۇتۇق

Muqam powers Uyghur speech recognition and text-to-speech, with support for regional accents and the Twelve Muqam musical tradition.

Transcription

endpoint
POST https://api.idirak.com/v1/audio/transcriptions
ParameterTypeDescription
filerequiredfileAudio file (mp3, mp4, wav, webm). Max 25 MB.
modelrequiredstringMust be muqam.
languagestringISO-639-1 code. Pass ug for Uyghur. Default: auto-detect.
response_formatstringjson, text, srt, vtt. Default: json.

Text-to-speech

endpoint
POST https://api.idirak.com/v1/audio/speech
speech.py
# Text-to-speech with Muqam
response = client.audio.speech.create(
    model="muqam",
    voice="dilnoza",   # available: dilnoza, abliz, mamtimin
    input="ئۇيغۇرچە تېكىست-ئاۋازغا ئايلاندۇرۇش سىستېمىسى.",
)
response.stream_to_file("output.mp3")

Script correction خەت تۈزىتىش

Kiroran specializes in normalizing and correcting Arabic-script Uyghur text — fixing vowel marks, Unicode normalization, and common OCR errors from scanned books.

endpoint
POST https://api.idirak.com/v1/script/correct
ParameterTypeDescription
textrequiredstringArabic-script Uyghur text to correct.
modestringnormalize, ocr_repair, or full. Default: full.
explainbooleanIf true, returns a diff of changes made. Default: false.
script.py
import httpx, os

resp = httpx.post(
    "https://api.idirak.com/v1/script/correct",
    headers={"Authorization": f"Bearer {os.environ['UYGHURAI_API_KEY']}"},
    json={
        "text": "يخشمسز",   # missing vowel marks
        "mode": "full",
        "explain": True,
    },
)
data = resp.json()
print(data["corrected"])   # → ياخشىمۇسىز
print(data["changes"])     # list of applied corrections

Models reference مودېل مەلۇماتنامىسى

Use these IDs in the model field.

Model IDTypeContextBest for
taklimakanFlagship200KAdvanced reasoning, long context
meshrepVision128KImage understanding & generation
atlasVision128KCultural image synthesis
lopnurScript64KResearch, writing, analysis
kiroranScript96KArabic-script correction
tarimGeneral128KChat, translation, summarization
muqamAudio64KSpeech recognition, TTS
doppaCompact32KOn-device, low latency
You can always retrieve the latest model list via GET https://api.idirak.com/v1/models.

Rate limits سۈرئەت چەكلىمىسى

Limits are applied per API key, per minute (RPM) and per day (RPD).

TierRPMTPMRPD
Free1040 K100
Pro100400 K5 000
EnterpriseUnlimitedUnlimitedUnlimited

When you exceed a limit the API returns 429 Too Many Requests with a Retry-After header.

Errors خاتالىق كودلىرى

All errors return a JSON body with error.code and error.message.

StatusCodeMeaning
400invalid_requestBad request — malformed JSON or missing required field
401invalid_api_keyAPI key missing or invalid
403permission_deniedKey does not have access to this model or feature
404model_not_foundThe requested model ID does not exist
422unprocessable_entityRequest understood but semantically invalid
429rate_limit_exceededToo many requests — see Retry-After header
500server_errorUnexpected server error — retry with backoff
503overloadedServer overloaded — retry after a short delay
error response
{
  "error": {
    "code": "rate_limit_exceeded",
    "message": "You have exceeded your rate limit of 10 requests per minute.",
    "type": "rate_limit_error",
    "param": null
  }
}