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.
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)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.
POST https://api.idirak.com/v1/chat/completions| Parameter | Type | Description |
|---|---|---|
modelrequired | string | Model ID, e.g. taklimakan, kiroran, tarim. |
messagesrequired | array | Array of message objects with role and content. |
stream | boolean | If true, responses are streamed as SSE. Default: false. |
max_tokens | integer | Max tokens to generate. Default: model maximum. |
temperature | number | Sampling temperature 0–2. Default: 1. |
top_p | number | Nucleus sampling probability. Default: 1. |
tools | array | Function definitions for tool/function calling. |
# 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.
POST https://api.idirak.com/v1/images/generate| Parameter | Type | Description |
|---|---|---|
promptrequired | string | Text description of the image to generate. Accepts Uyghur script. |
model | string | Must be atlas. Default: atlas. |
n | integer | Number of images to generate (1–4). Default: 1. |
size | string | Output dimensions: 512x512, 1024x1024, 1024x1792. Default: 1024x1024. |
style | string | Visual style preset: cultural, modern, calligraphy, ikat. |
response_format | string | url or b64_json. Default: url. |
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
POST https://api.idirak.com/v1/audio/transcriptions| Parameter | Type | Description |
|---|---|---|
filerequired | file | Audio file (mp3, mp4, wav, webm). Max 25 MB. |
modelrequired | string | Must be muqam. |
language | string | ISO-639-1 code. Pass ug for Uyghur. Default: auto-detect. |
response_format | string | json, text, srt, vtt. Default: json. |
Text-to-speech
POST https://api.idirak.com/v1/audio/speech# 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.
POST https://api.idirak.com/v1/script/correct| Parameter | Type | Description |
|---|---|---|
textrequired | string | Arabic-script Uyghur text to correct. |
mode | string | normalize, ocr_repair, or full. Default: full. |
explain | boolean | If true, returns a diff of changes made. Default: false. |
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 correctionsModels reference مودېل مەلۇماتنامىسى
Use these IDs in the model field.
| Model ID | Type | Context | Best for |
|---|---|---|---|
taklimakan | Flagship | 200K | Advanced reasoning, long context |
meshrep | Vision | 128K | Image understanding & generation |
atlas | Vision | 128K | Cultural image synthesis |
lopnur | Script | 64K | Research, writing, analysis |
kiroran | Script | 96K | Arabic-script correction |
tarim | General | 128K | Chat, translation, summarization |
muqam | Audio | 64K | Speech recognition, TTS |
doppa | Compact | 32K | On-device, low latency |
GET https://api.idirak.com/v1/models.Rate limits سۈرئەت چەكلىمىسى
Limits are applied per API key, per minute (RPM) and per day (RPD).
| Tier | RPM | TPM | RPD |
|---|---|---|---|
| Free | 10 | 40 K | 100 |
| Pro | 100 | 400 K | 5 000 |
| Enterprise | Unlimited | Unlimited | Unlimited |
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.
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | Bad request — malformed JSON or missing required field |
| 401 | invalid_api_key | API key missing or invalid |
| 403 | permission_denied | Key does not have access to this model or feature |
| 404 | model_not_found | The requested model ID does not exist |
| 422 | unprocessable_entity | Request understood but semantically invalid |
| 429 | rate_limit_exceeded | Too many requests — see Retry-After header |
| 500 | server_error | Unexpected server error — retry with backoff |
| 503 | overloaded | Server overloaded — retry after a short delay |
{
"error": {
"code": "rate_limit_exceeded",
"message": "You have exceeded your rate limit of 10 requests per minute.",
"type": "rate_limit_error",
"param": null
}
}