{"openapi":"3.1.0","info":{"title":"Fanar API","description":"You can interact with FanarAPI for seamless chat completion and text processing using Fanar.<br/><strong>Base URL:</strong> https://api.fanar.qa<br/><strong>Request API Access:</strong> <a href='https://api.fanar.qa/request'>https://api.fanar.qa/request</a><h2>Rate Limits</h2>\n<p>To ensure fair usage and optimal performance for all users, our API has rate limits in place. When you exceed a rate limit, your request will typically receive a <code>429 Too Many Requests</code> HTTP status code.</p>\n<details class=\"fnr-section\" open>\n<summary class=\"fnr-summary\">Limits by model</summary>\n<p>These are our default settings for all models. We understand that your needs may vary. If your application requires higher throughput or more tailored rate limits for specific models, please contact us:</p>\n<table>\n    <thead>\n        <tr>\n            <th>Model</th>\n            <th>Rate Limit</th>\n        </tr>\n    </thead>\n    <tbody><tr>\n            <td><strong>Fanar</strong></td>\n            <td>50 requests/minute</td>\n        </tr>\n        <tr>\n            <td><strong>Fanar-S-1-7B</strong></td>\n            <td>50 requests/minute</td>\n        </tr>\n        <tr>\n            <td><strong>Fanar-C-1-8.7B</strong></td>\n            <td>50 requests/minute</td>\n        </tr>\n        <tr>\n            <td><strong>Fanar-C-2-27B</strong></td>\n            <td>50 requests/minute</td>\n        </tr>\n        <tr>\n            <td><strong>Fanar-Sadiq</strong></td>\n            <td>50 requests/minute</td>\n        </tr>\n        <tr>\n            <td><strong>Fanar-Sadiq-2</strong></td>\n            <td>50 requests/minute</td>\n        </tr>\n        <tr>\n            <td><strong>Fanar-Sadiq-2 (validate)</strong></td>\n            <td>200 requests/minute</td>\n        </tr>\n        <tr>\n            <td><strong>Fanar-Sadiq-2 (deep research)</strong></td>\n            <td>20 requests/day</td>\n        </tr>\n        <tr>\n            <td><strong>Fanar-Sadiq-TTS-1</strong></td>\n            <td>20 requests/day</td>\n        </tr>\n        <tr>\n            <td><strong>Fanar-Oryx-IVU-2</strong></td>\n            <td>20 requests/day</td>\n        </tr>\n        <tr>\n            <td><strong>Fanar-Aura-TTS-2</strong></td>\n            <td>20 requests/day</td>\n        </tr>\n        <tr>\n            <td><strong>Fanar-Aura-STT-1</strong></td>\n            <td>20 requests/day</td>\n        </tr>\n        <tr>\n            <td><strong>Fanar-Aura-STT-LF-1</strong></td>\n            <td>10 requests/day</td>\n        </tr>\n        <tr>\n            <td><strong>Fanar-Oryx-IG-2</strong></td>\n            <td>20 requests/day</td>\n        </tr>\n        <tr>\n            <td><strong>Fanar-Guard-2</strong></td>\n            <td>50 requests/minute</td>\n        </tr>\n        <tr>\n            <td><strong>Fanar-Shaheen-MT-1</strong></td>\n            <td>20 requests/day</td>\n        </tr>\n        <tr>\n            <td><strong>Fanar-Shaheen-MT-2</strong></td>\n            <td>20 requests/day</td>\n        </tr>\n        <tr>\n            <td><strong>Fanar-Diwan</strong></td>\n            <td>50 requests/minute</td>\n        </tr>\n        </tbody>\n</table>\n</details>\n<details class=\"fnr-section fnr-section-headers\">\n<summary class=\"fnr-summary\">Response headers</summary>\n<p>Every rate-limited response reports your current quota, so you can back off before being throttled:</p>\n<table>\n    <thead>\n        <tr>\n            <th>Header</th>\n            <th>Description</th>\n        </tr>\n    </thead>\n    <tbody>\n        <tr><td><code>x-ratelimit-limit</code></td><td>Requests allowed per window.</td></tr>\n        <tr><td><code>x-ratelimit-remaining</code></td><td>Requests still available in the current window.</td></tr>\n        <tr><td><code>x-ratelimit-reset</code></td><td>Seconds until a request slot frees up.</td></tr>\n        <tr><td><code>ratelimit-policy</code></td><td>The quota and its window in seconds, as <code>limit;w=seconds</code> &mdash; so <code>100;w=86400</code> means 100 requests per day.</td></tr>\n        <tr><td><code>retry-after</code></td><td>Seconds to wait before retrying, sent only on a <code>429</code>. When your own quota ran out it counts down to a free slot; when an upstream service throttled the request it carries that service's own hint instead.</td></tr>\n    </tbody>\n</table>\n<p class=\"fnr-note\">Because <code>x-ratelimit-limit</code> alone cannot tell <code>3</code> per minute from <code>3</code> per day, read <code>ratelimit-policy</code> when you need the window. These headers are omitted for API keys with unlimited quota.</p>\n</details>\n","termsOfService":"https://api.fanar.qa/terms-of-service","contact":{"name":"Fanar Support","url":"https://fanar.qa/","email":"support@fanar.qa"},"version":"1.0.0","x-logo":{"url":"/static/white-logo.svg","alt":"logo"}},"paths":{"/v1/chat/completions":{"post":{"tags":["Chat"],"summary":"Create Chat Completion","description":"This endpoint is compatible with the OpenAI library. If certain parameters are not supported by the OpenAI library, they can be provided in the `extra_body` field of the OpenAI request.<br/>When creating the OpenAI object, set the `base_url` as the API domain followed by `/v1`.","operationId":"create_chat_completion_v1_chat_completions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionRequest"}}},"required":true},"responses":{"200":{"description":"Chat completion response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionResponse"}},"text/event-stream":{"schema":{"oneOf":[{"$ref":"#/components/schemas/TokenChunk"},{"$ref":"#/components/schemas/ToolCallChunk"},{"$ref":"#/components/schemas/ToolResultChunk"},{"$ref":"#/components/schemas/ProgressChunk"},{"$ref":"#/components/schemas/DoneChunk"},{"$ref":"#/components/schemas/ErrorChunk"}]}}}},"400":{"description":"The content was filtered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"content_filter","message":"The content was filtered","status":400,"param":"prompt","type":"safety"}}}}},"401":{"description":"Invalid authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authentication","message":"Invalid authentication","status":401}}}}},"403":{"description":"Invalid authorization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authorization","message":"Invalid authorization","status":403}}}}},"429":{"description":"Rate limit reached or Exceeded quota","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"exceeded_quota","message":"Exceeded quota","status":429}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_server_error","message":"Internal server error","status":500}}}}},"503":{"description":"Service overloaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"overloaded","message":"Service overloaded","status":503}}}}},"504":{"description":"Request timed out","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"timeout","message":"Request timed out","status":504}}}}},"413":{"description":"Request entity too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"too_large","message":"Request entity too large","status":413}}}}},"422":{"description":"Unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unprocessable","message":"Unprocessable","status":422}}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"conflict","message":"Conflict","status":409}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"Not found","message":"Not found","status":404}}}}},"410":{"description":"No longer supported","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"no_longer_supported","message":"No longer supported","status":410}}}}},"499":{"description":"Client closed request before completion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"client_closed_request","message":"Client closed request before completion","status":499}}}}}},"security":[{"Bearer":[]}],"x-codeSamples":[{"lang":"Curl","label":"cURL","source":"curl -X POST \"https://api.fanar.qa/v1/chat/completions\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer YOUR_API_KEY_HERE\" \\\n  -d '{\n    \"model\": \"Fanar\",\n    \"messages\": [\n      {\n        \"role\": \"user\",\n        \"content\": \"Your message here\"\n      }\n    ]\n  }'\n"},{"lang":"Python","label":"Python - OpenAI","source":"from openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"https://api.fanar.qa/v1\",\n    api_key=\"YOUR_API_KEY_HERE\",\n)\n\nmodel_name = \"Fanar\"\nmessages = [\n    {\"role\": \"user\", \"content\": \"Your message here\"}\n]\n\nresponse = client.chat.completions.create(\n    model=model_name,\n    messages=messages,\n)\n\nprint(\"Assistant Response:\\n\")\nprint(response.choices[0].message.content)\n"},{"lang":"Python - OpenAI Stream","label":"Python - OpenAI Stream","source":"from openai import AsyncOpenAI\n\nclient = AsyncOpenAI(\n    base_url=\"https://api.fanar.qa/v1\",\n    api_key=\"YOUR_API_KEY_HERE\",\n)\n\nmessages = [\n    {\"role\": \"user\", \"content\": \"Your message here\"}\n]\n\nstream = await client.chat.completions.create(\n    model=\"Fanar\",\n    messages=messages,\n    stream=True\n)\n\nprint(\"Assistant Response:\\n\")\n\ncontent = \"\"\nreferences = None\n\nasync for chunk in stream:\n    if chunk.choices and chunk.choices[0].delta:\n        delta = chunk.choices[0].delta\n        \n        # Capture references from the first chunk\n        if hasattr(delta, 'references') and delta.references:\n            references = delta.references\n        \n        # Stream content as it arrives\n        if delta.content:\n            content += delta.content\n            print(delta.content, end=\"\", flush=True)\n\nprint(\"\\n\")\n\n# Print references if present\nif references:\n    print(\"\\nReferences:\")\n    for ref in references:\n        number = ref.get(\"number\", \"-\")\n        source = ref.get(\"source\", \"Unknown source\")\n        ref_content = ref.get(\"content\", \"\")\n        print(f\"\\n[{number}] {source}\\n{ref_content}\")\n"},{"lang":"Python - Fanar-Sadiq","label":"Python - Fanar-Sadiq","source":"import requests\n\ndef model_api(messages, model):\n    headers = {\n        \"Authorization\": \"Bearer YOUR_API_KEY_HERE\",\n        \"Content-Type\": \"application/json\",\n    }\n\n    payload = {\n        \"model\": model,\n        \"messages\": messages,\n        \"max_tokens\": 750,\n    }\n\n    response = requests.post(\n        \"https://api.fanar.qa/v1/chat/completions\", \n        json=payload, \n        headers=headers\n    )\n    return response.json()\n\nmodel = \"Fanar-Sadiq\"\n\nprompt = \"What are the Islamic values?\"\n\nmessages = [\n    {\"role\": \"user\", \"content\": prompt}\n]\n\nresponse = model_api(messages=messages, model=model)\n\n# Extract the assistant's answer\ncontent = response[\"choices\"][0][\"message\"][\"content\"]\nprint(\"Assistant Response:\\n\")\nprint(content)\n\n# Print reference sources if present\nreferences = response[\"choices\"][0][\"message\"].get(\"references\", [])\nif references:\n    print(\"\\nReferences:\")\n    for ref in references:\n        number = ref.get(\"number\", \"-\")\n        source = ref.get(\"source\", \"Unknown source\")\n        ref_content = ref.get(\"content\", \"\")\n        print(f\"\\n[{number}] {source}\\n{ref_content}\")\nelse:\n    print(\"\\nNo references returned.\")\n"},{"lang":"Python - Fanar-Sadiq with persona","label":"Python - Fanar-Sadiq with persona","source":"# The \"persona\" parameter controls the assistant's voice and identity.\n# It is only supported for the Fanar-Sadiq model.\n\nimport requests\n\ndef model_api(messages, persona=None):\n    headers = {\n        \"Authorization\": \"Bearer YOUR_API_KEY_HERE\",\n        \"Content-Type\": \"application/json\",\n    }\n\n    payload = {\n        \"model\": \"Fanar-Sadiq\",\n        \"messages\": messages,\n        \"max_tokens\": 750,\n    }\n    if persona:\n        payload[\"persona\"] = persona\n\n    response = requests.post(\n        \"https://api.fanar.qa/v1/chat/completions\",\n        json=payload,\n        headers=headers,\n    )\n    return response.json()\n\nmessages = [\n    {\"role\": \"user\", \"content\": \"What are the Islamic values?\"}\n]\n\n# Customize the assistant's voice/identity for this call.\npersona = \"You are a warm, patient teacher who explains concepts simply for young students.\"\n\nresponse = model_api(messages=messages, persona=persona)\n\ncontent = response[\"choices\"][0][\"message\"][\"content\"]\nprint(\"Assistant Response:\\n\")\nprint(content)\n\n# Print reference sources if present\nreferences = response[\"choices\"][0][\"message\"].get(\"references\", [])\nif references:\n    print(\"\\nReferences:\")\n    for ref in references:\n        number = ref.get(\"number\", \"-\")\n        source = ref.get(\"source\", \"Unknown source\")\n        ref_content = ref.get(\"content\", \"\")\n        print(f\"\\n[{number}] {source}\\n{ref_content}\")\nelse:\n    print(\"\\nNo references returned.\")\n"},{"lang":"Python - Fanar-Sadiq-2","label":"Python - Fanar-Sadiq-2","source":"# Fanar-Sadiq-2 requires additional authorization and is not allowed by default.\n\nimport requests\n\ndef model_api(messages, madhab=None):\n    headers = {\n        \"Authorization\": \"Bearer YOUR_API_KEY_HERE\",\n        \"Content-Type\": \"application/json\",\n    }\n\n    payload = {\n        \"model\": \"Fanar-Sadiq-2\",\n        \"messages\": messages,\n    }\n    if madhab:\n        payload[\"madhab\"] = madhab\n\n    response = requests.post(\n        \"https://api.fanar.qa/v1/chat/completions\",\n        json=payload,\n        headers=headers,\n    )\n    return response.json()\n\nmessages = [\n    {\"role\": \"user\", \"content\": \"What are the conditions for Zakat on gold according to the Hanafi school?\"}\n]\n\nresponse = model_api(messages=messages, madhab=[\"hanafi\"])\n\ncontent = response[\"choices\"][0][\"message\"][\"content\"]\nprint(\"Assistant Response:\\n\")\nprint(content)\n\n# Print reference sources if present\nreferences = response[\"choices\"][0][\"message\"].get(\"references\", [])\nif references:\n    print(\"\\nReferences:\")\n    for ref in references:\n        number = ref.get(\"number\", \"-\")\n        source = ref.get(\"source\", \"Unknown source\")\n        ref_content = ref.get(\"content\", \"\")\n        print(f\"\\n[{number}] {source}\\n{ref_content}\")\n"},{"lang":"Python - Thinking mode (Fanar-C-1-8.7B)","label":"Python - Thinking mode (Fanar-C-1-8.7B)","source":"# Thinking mode requires additional authorization and is not allowed by default.\n\nimport requests\n\ndef model_api(messages, max_tokens=500):\n    headers = {\n        \"Authorization\": \"Bearer YOUR_API_KEY_HERE\",\n        \"Content-Type\": \"application/json\",\n    }\n\n    payload = {\n        \"model\": \"Fanar-C-1-8.7B\",\n        \"messages\": messages,\n        \"max_tokens\": max_tokens,\n    }\n\n    response = requests.post(\n        \"https://api.fanar.qa/v1/chat/completions\", \n        json=payload, \n        headers=headers\n    )\n    return response.json()\n\n# Step 1: User message with \"thinking_user\" role\nmessages = [\n  {\"role\": \"thinking_user\", \"content\": user_input}\n]\n\n# Step 2: Send request to model with extended max tokens\nresponse = model_api(\n    messages=messages,\n    max_tokens=2000,\n)\n\noutput = response[\"choices\"][0][\"message\"][\"content\"]\nfinish_reason = response[\"choices\"][0][\"finish_reason\"]\n\n# Step 3: Check if thinking mode continuation is needed\nhas_think_tag = \"</think>\" in output\nhit_length_limit = finish_reason == \"length\"\n\nif has_think_tag or hit_length_limit:\n    # Extract thinking output\n    thinking_output = output.split(\"</think>\")[0] if has_think_tag else output\n\n    # Modify the last \"thinking_user\" role message to \"user\"\n    for msg in reversed(messages):\n        if msg[\"role\"] == \"thinking_user\":\n            msg[\"role\"] = \"user\"\n            break\n\n    # Add new \"thinking\" role message with extracted output\n    messages.append({\"role\": \"thinking\", \"content\": thinking_output})\n\n    # Re-run model with updated messages, shorter max tokens\n    final_response = model_api(\n        messages=messages,\n        max_tokens=1000,\n    )\n\n    final_output = final_response[\"choices\"][0][\"message\"][\"content\"]\nelse:\n    final_output = output\n\n# final_output now contains the full response after handling thinking mode\nprint(\"Assistant Response:\\n\")\nprint(final_output)\n"},{"lang":"Python - Thinking mode (Fanar-C-2-27B)","label":"Python - Thinking mode (Fanar-C-2-27B)","source":"# Thinking mode requires additional authorization and is not allowed by default.\n\nimport requests\n\ndef model_api(messages, max_tokens=4000):\n    headers = {\n        \"Authorization\": \"Bearer YOUR_API_KEY_HERE\",\n        \"Content-Type\": \"application/json\",\n    }\n\n    payload = {\n        \"model\": \"Fanar-C-2-27B\",\n        \"messages\": messages,\n        \"max_tokens\": max_tokens,\n        \"enable_thinking\": True\n    }\n\n    response = requests.post(\n        \"https://api.fanar.qa/v1/chat/completions\", \n        json=payload, \n        headers=headers\n    )\n    return response.json()\n\nmessages = [\n  {\"role\": \"user\", \"content\": user_input}\n]\n\nresponse = model_api(\n    messages=messages\n)\n\nprint(\"Assistant Response:\\n\")\nprint(response)\n"},{"lang":"Python - Image understanding","label":"Python - Image understanding","source":"# Image understanding requires additional authorization and is not allowed by default.\n\nimport requests\nimport base64\n\ndef model_api(messages):\n    headers = {\n        \"Authorization\": \"Bearer YOUR_API_KEY_HERE\",\n        \"Content-Type\": \"application/json\",\n    }\n\n    payload = {\n        \"model\": \"Fanar-Oryx-IVU-2\",\n        \"messages\": messages,\n        \"max_tokens\": 750,\n    }\n\n    response = requests.post(\"https://api.fanar.qa/v1/chat/completions\", json=payload, headers=headers)\n    return response.json()\n\nwith open(\"path/to/image.jpg\", \"rb\") as image_file:\n    raw_b64 = base64.b64encode(image_file.read()).decode(\"utf-8\")\n\nimage_b64_url = f\"data:image/jpeg;base64,{raw_b64}\"\n\nprompt = \"Tell me about this image.\"\n\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\n                \"type\": \"text\",\n                \"text\": prompt\n            },\n            {\n                \"type\": \"image_url\",\n                \"image_url\": {\n                    \"url\": image_b64_url\n                }\n            }\n        ]\n    }\n]\n\nresponse = model_api(messages=messages)\n\ncontent = response[\"choices\"][0][\"message\"][\"content\"]\nprint(\"Assistant Response:\\n\")\nprint(content)\n"}]}},"/v1/audio/speech":{"post":{"tags":["Audio"],"summary":"Create Speech","description":"This endpoint is compatible with the OpenAI library.<br/>Generates audio from the input text.","operationId":"create_speech_v1_audio_speech_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TextToSpeechRequest"}}},"required":true},"responses":{"200":{"description":"The audio file content or error details.","headers":{"X-Id":{"description":"A unique identifier for the text-to-speech.","schema":{"type":"string","format":"uuid"}},"X-Revised-Input":{"description":"The processed input text after Quran and hadith validation and tagging. This header is only present when using the Fanar-Sadiq-TTS model. The validator identifies Quranic verses and hadith in the input; verses are wrapped with XML-style tags (e.g., `<quran_start>`, `<quran_end>`) for proper handling during text-to-speech processing, and corrections such as diacritical marks normalization or verse formatting may be applied. Hadith tags and the markdown reference links the validator adds (quran.com / sunnah.com) are stripped before synthesis, so this header reflects the exact text sent to the speech backend. If no Qur'anic verses or hadith were detected or no modifications were needed, this header will be absent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{}},"audio/mpeg":{"schema":{"type":"string","format":"binary"}},"audio/wav":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"The content was filtered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"content_filter","message":"The content was filtered","status":400,"param":"prompt","type":"safety"}}}}},"401":{"description":"Invalid authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authentication","message":"Invalid authentication","status":401}}}}},"403":{"description":"Invalid authorization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authorization","message":"Invalid authorization","status":403}}}}},"429":{"description":"Rate limit reached or Exceeded quota","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"exceeded_quota","message":"Exceeded quota","status":429}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_server_error","message":"Internal server error","status":500}}}}},"503":{"description":"Service overloaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"overloaded","message":"Service overloaded","status":503}}}}},"504":{"description":"Request timed out","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"timeout","message":"Request timed out","status":504}}}}},"413":{"description":"Request entity too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"too_large","message":"Request entity too large","status":413}}}}},"422":{"description":"Unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unprocessable","message":"Unprocessable","status":422}}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"conflict","message":"Conflict","status":409}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"Not found","message":"Not found","status":404}}}}},"410":{"description":"No longer supported","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"no_longer_supported","message":"No longer supported","status":410}}}}},"499":{"description":"Client closed request before completion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"client_closed_request","message":"Client closed request before completion","status":499}}}}}},"security":[{"Bearer":[]}],"x-codeSamples":[{"lang":"Curl","label":"cURL","source":"curl -X POST \"https://api.fanar.qa/v1/audio/speech\" \\\n-H \"Content-Type: application/json\" \\\n-H \"Authorization: Bearer YOUR_API_KEY\" \\\n--output greeting.mp3 \\\n-d '{\n  \"model\": \"Fanar-Aura-TTS-2\",\n  \"input\": \"Hello! I hope you are having a wonderful day.\",\n  \"voice\": \"Amelia\",\n  \"response_format\": \"mp3\"\n}'\n"},{"lang":"Python","label":"Python - OpenAI","source":"# Text-to-Speech requires additional authorization and is not allowed by default.\n\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"https://api.fanar.qa/v1\",\n    api_key=\"YOUR_API_KEY\"\n)\n\nresponse = client.audio.speech.create(\n    model=\"Fanar-Aura-TTS-2\",\n    input=\"Hello! I hope you are having a wonderful day.\",\n    voice=\"Amelia\",\n    response_format=\"mp3\",\n)\n\nwith open(\"greeting.mp3\", \"wb\") as f:\n    f.write(response.read())\n"},{"lang":"Python - requests","label":"Python - requests","source":"# Text-to-Speech requires additional authorization and is not allowed by default.\n\nimport requests\n\nurl = \"https://api.fanar.qa/v1/audio/speech\"\nheaders = {\n    \"Authorization\": \"Bearer YOUR_API_KEY\",\n    \"Content-Type\": \"application/json\"\n}\ndata = {\n    \"model\": \"Fanar-Aura-TTS-2\",\n    \"input\": \"Hello! I hope you are having a wonderful day.\",\n    \"voice\": \"Amelia\",\n    \"response_format\": \"mp3\"\n}\n\nresponse = requests.post(url, headers=headers, json=data)\n\nwith open(\"greeting.mp3\", \"wb\") as f:\n    f.write(response.content)\n"},{"lang":"Python - requests for Quranic text","label":"Python - requests for Quranic text","source":"# Text-to-Speech requires additional authorization and is not allowed by default.\n\nimport requests\n\nurl = \"https://api.fanar.qa/v1/audio/speech\"\nheaders = {\n    \"Authorization\": \"Bearer YOUR_API_KEY\",\n    \"Content-Type\": \"application/json\"\n}\ndata = {\n    \"model\": \"Fanar-Sadiq-TTS-1\",\n    \"input\": \"Quranic text goes here\",\n    \"voice\": \"Amelia\",\n    \"quran_reciter\": \"abdul-basit\",\n    \"response_format\": \"mp3\"\n}\n\nresponse = requests.post(url, headers=headers, json=data)\n\nrevised_input = response.headers.get('X-Revised-Input')\nif revised_input:\n    from urllib.parse import unquote\n    print(\"Revised Input:\", unquote(revised_input))\n\nwith open(\"quranic_speech.mp3\", \"wb\") as f:\n    f.write(response.content)\n"},{"lang":"cURL - streaming","label":"cURL - streaming","source":"# Pass \"stream\": true to receive audio bytes progressively as they are\n# synthesized. The response Content-Type is identical to the non-streaming\n# case (audio/wav or audio/mpeg) but uses chunked transfer encoding, so\n# `--output greeting.mp3` keeps working. The first byte arrives much\n# sooner for longer inputs.\n\ncurl -X POST \"https://api.fanar.qa/v1/audio/speech\" \\\n-H \"Content-Type: application/json\" \\\n-H \"Authorization: Bearer YOUR_API_KEY\" \\\n--no-buffer \\\n--output greeting.mp3 \\\n-d '{\n  \"model\": \"Fanar-Aura-TTS-2\",\n  \"input\": \"Hello! I hope you are having a wonderful day.\",\n  \"voice\": \"Amelia\",\n  \"response_format\": \"mp3\",\n  \"stream\": true\n}'\n"},{"lang":"Python - OpenAI streaming","label":"Python - OpenAI streaming","source":"# Text-to-Speech requires additional authorization and is not allowed by default.\n# Use the OpenAI SDK's with_streaming_response helper to play audio as it\n# arrives. `stream: true` is passed via `extra_body` since it's a\n# Fanar-specific extension to the OpenAI-compatible schema.\n\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"https://api.fanar.qa/v1\",\n    api_key=\"YOUR_API_KEY\"\n)\n\nwith client.audio.speech.with_streaming_response.create(\n    model=\"Fanar-Aura-TTS-2\",\n    input=\"Hello! I hope you are having a wonderful day.\",\n    voice=\"Amelia\",\n    response_format=\"wav\",\n    extra_body={\"stream\": True},\n) as response:\n    response.stream_to_file(\"greeting.wav\")\n"},{"lang":"Python - requests streaming","label":"Python - requests streaming","source":"# Text-to-Speech requires additional authorization and is not allowed by default.\n# Pass stream=True to requests so it doesn't pre-buffer the body, then\n# iterate over chunks. The first chunk arrives within ~1 s even for long\n# inputs that would otherwise wait many seconds for the full synthesis.\n\nimport requests\n\nurl = \"https://api.fanar.qa/v1/audio/speech\"\nheaders = {\n    \"Authorization\": \"Bearer YOUR_API_KEY\",\n    \"Content-Type\": \"application/json\"\n}\ndata = {\n    \"model\": \"Fanar-Aura-TTS-2\",\n    \"input\": \"Hello! I hope you are having a wonderful day.\",\n    \"voice\": \"Amelia\",\n    \"response_format\": \"wav\",\n    \"stream\": True\n}\n\nwith requests.post(url, headers=headers, json=data, stream=True) as r:\n    r.raise_for_status()\n    with open(\"greeting.wav\", \"wb\") as f:\n        for chunk in r.iter_content(chunk_size=8192):\n            if chunk:\n                f.write(chunk)"}]}},"/v1/audio/transcriptions":{"post":{"tags":["Audio"],"summary":"Create Transcription","description":"This endpoint is compatible with the OpenAI library.<br/>Transcribes audio into the input language.","operationId":"create_transcription_v1_audio_transcriptions_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_transcription_v1_audio_transcriptions_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/SpeechToTextResponseWithText"},{"$ref":"#/components/schemas/SpeechToTextResponseWithSRT"},{"$ref":"#/components/schemas/SpeechToTextResponseWithJson-Output"}],"title":"Response Create Transcription V1 Audio Transcriptions Post"}}}},"400":{"description":"The content was filtered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"content_filter","message":"The content was filtered","status":400,"param":"prompt","type":"safety"}}}}},"401":{"description":"Invalid authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authentication","message":"Invalid authentication","status":401}}}}},"403":{"description":"Invalid authorization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authorization","message":"Invalid authorization","status":403}}}}},"429":{"description":"Rate limit reached or Exceeded quota","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"exceeded_quota","message":"Exceeded quota","status":429}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_server_error","message":"Internal server error","status":500}}}}},"503":{"description":"Service overloaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"overloaded","message":"Service overloaded","status":503}}}}},"504":{"description":"Request timed out","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"timeout","message":"Request timed out","status":504}}}}},"413":{"description":"Request entity too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"too_large","message":"Request entity too large","status":413}}}}},"422":{"description":"Unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unprocessable","message":"Unprocessable","status":422}}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"conflict","message":"Conflict","status":409}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"Not found","message":"Not found","status":404}}}}},"410":{"description":"No longer supported","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"no_longer_supported","message":"No longer supported","status":410}}}}},"499":{"description":"Client closed request before completion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"client_closed_request","message":"Client closed request before completion","status":499}}}}}},"security":[{"Bearer":[]}],"x-codeSamples":[{"lang":"Curl","label":"cURL Example","source":"curl -X POST \"https://api.fanar.qa/v1/audio/transcriptions\" \\\n  -H \"Authorization: Bearer YOUR_API_KEY\" \\\n  -H \"Content-Type: multipart/form-data\" \\\n  -F \"file=@sample.wav\" \\\n  -F \"model=Fanar-Aura-STT-1\"\n"},{"lang":"Python","label":"Python - OpenAI","source":"# Audio Transcriptions requires additional authorization and is not allowed by default.\n\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"https://api.fanar.qa/v1\",\n    api_key=\"YOUR_API_KEY\"\n)\n\nwith open(\"sample.wav\", \"rb\") as f:\n    response = client.audio.transcriptions.create(\n        file=f,\n        model=\"Fanar-Aura-STT-1\"\n    )\n\nprint(response.text)\n"},{"lang":"Python - requests","label":"Python - requests","source":"# Audio Transcriptions requires additional authorization and is not allowed by default.\n\nimport requests\n\nurl = \"https://api.fanar.qa/v1/audio/transcriptions\"\nheaders = {\n    \"Authorization\": \"Bearer YOUR_API_KEY\"\n}\nfiles = {\n    \"file\": open(\"sample.wav\", \"rb\")\n}\ndata = {\n    \"model\": \"Fanar-Aura-STT-1\"\n}\n\nresponse = requests.post(url, headers=headers, files=files, data=data)\n\nprint(response.json().get(\"text\"))\n"},{"lang":"Python - requests with longform audio (JSON format)","label":"Python - requests with longform audio (JSON format)","source":"# Audio Transcriptions requires additional authorization and is not allowed by default.\n\nimport requests\n\nurl = \"https://api.fanar.qa/v1/audio/transcriptions\"\nheaders = {\n    \"Authorization\": \"Bearer YOUR_API_KEY\"\n}\nfiles = {\n    \"file\": open(\"sample.wav\", \"rb\")\n}\ndata = {\n    \"model\": \"Fanar-Aura-STT-LF-1\",\n    \"format\": \"json\"\n}\n\nresponse = requests.post(url, headers=headers, files=files, data=data)\n\nprint(response.json().get(\"json\"))"}]}},"/v1/audio/voices":{"get":{"tags":["Audio"],"summary":"List Voices","description":"Lists all available text-to-speech voices.<br/>The list will include all built-in (public) voices by default. If your API key is authorized to <a href=\"#tag/audio/POST/v1/audio/voices\">create personalized voices</a>, they will be included in the list and labeled as <code>type: \"personal\"</code>.","operationId":"list_voices_v1_audio_voices_get","responses":{"200":{"description":"A list of available voices.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceResponse"},"example":{"voices":[{"name":"Amelia","name_ar":"أميليا","gender":"Female","accent":"British","languages":["en"],"type":"public","emotion":false},{"name":"Hamad","name_ar":"حمد","gender":"Male","accent":"Gulf","languages":["ar"],"type":"public","emotion":false},{"name":"MyVoice","languages":[],"type":"personal","emotion":false}]}}}},"400":{"description":"The content was filtered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"content_filter","message":"The content was filtered","status":400,"param":"prompt","type":"safety"}}}}},"401":{"description":"Invalid authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authentication","message":"Invalid authentication","status":401}}}}},"403":{"description":"Invalid authorization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authorization","message":"Invalid authorization","status":403}}}}},"429":{"description":"Rate limit reached or Exceeded quota","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"exceeded_quota","message":"Exceeded quota","status":429}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_server_error","message":"Internal server error","status":500}}}}},"503":{"description":"Service overloaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"overloaded","message":"Service overloaded","status":503}}}}},"504":{"description":"Request timed out","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"timeout","message":"Request timed out","status":504}}}}},"413":{"description":"Request entity too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"too_large","message":"Request entity too large","status":413}}}}},"422":{"description":"Unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unprocessable","message":"Unprocessable","status":422}}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"conflict","message":"Conflict","status":409}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"Not found","message":"Not found","status":404}}}}},"410":{"description":"No longer supported","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"no_longer_supported","message":"No longer supported","status":410}}}}},"499":{"description":"Client closed request before completion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"client_closed_request","message":"Client closed request before completion","status":499}}}}}},"security":[{"Bearer":[]}],"x-codeSamples":[{"lang":"Curl","label":"cURL","source":"curl -X GET \"https://api.fanar.qa/v1/audio/voices\" \\\n-H \"Content-Type: application/json\" \\\n-H \"Authorization: Bearer YOUR_API_KEY\"\n"},{"lang":"Python","label":"Python - requests","source":"# Voice personalization requires additional authorization and is not allowed by default.\n\nimport requests\n\nurl = \"https://api.fanar.qa/v1/audio/voices\"\nheaders = {\n    \"Authorization\": \"Bearer YOUR_API_KEY\",\n    \"Content-Type\": \"application/json\"\n}\nresponse = requests.get(url, headers=headers)\nvoices = response.json()\nprint(voices)"}]},"post":{"tags":["Audio"],"summary":"Create Voice","description":"Creates a personalized voice that can be used to generate speech.<br/>The voice name must be unique among your own personalized voices. Names that match a built-in (public) voice are allowed — public voices and your personalized voices live in separate namespaces. When you request a voice name that exists in both, your personalized voice takes precedence at synthesis time in <a href=\"#tag/audio/POST/v1/audio/speech\"><code>POST /v1/audio/speech</code></a>.<br/>This endpoint requires additional authorization and is not allowed by default. Please contact <a href='mailto:support@fanar.qa'>support@fanar.qa</a>.","operationId":"create_voice_v1_audio_voices_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_voice_v1_audio_voices_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"The content was filtered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"content_filter","message":"The content was filtered","status":400,"param":"prompt","type":"safety"}}}}},"401":{"description":"Invalid authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authentication","message":"Invalid authentication","status":401}}}}},"403":{"description":"Invalid authorization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authorization","message":"Invalid authorization","status":403}}}}},"429":{"description":"Rate limit reached or Exceeded quota","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"exceeded_quota","message":"Exceeded quota","status":429}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_server_error","message":"Internal server error","status":500}}}}},"503":{"description":"Service overloaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"overloaded","message":"Service overloaded","status":503}}}}},"504":{"description":"Request timed out","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"timeout","message":"Request timed out","status":504}}}}},"413":{"description":"Request entity too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"too_large","message":"Request entity too large","status":413}}}}},"422":{"description":"Unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unprocessable","message":"Unprocessable","status":422}}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"conflict","message":"Conflict","status":409}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"Not found","message":"Not found","status":404}}}}},"410":{"description":"No longer supported","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"no_longer_supported","message":"No longer supported","status":410}}}}},"499":{"description":"Client closed request before completion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"client_closed_request","message":"Client closed request before completion","status":499}}}}}},"security":[{"Bearer":[]}],"x-codeSamples":[{"lang":"Curl","label":"cURL","source":"curl -X POST \"https://api.fanar.qa/v1/audio/voices\" \\\n-H \"Authorization: Bearer YOUR_API_KEY\" \\\n-F \"audio=@custom-voice-sample.wav;type=audio/wav\" \\\n-F \"name=CustomVoice1\" \\\n-F \"transcript=This is a sample transcription.\"\n"},{"lang":"Python","label":"Python - requests","source":"# Voice personalization requires additional authorization and is not allowed by default.\n\nimport requests\nfrom pydub import AudioSegment\nfrom io import BytesIO\n\nurl = \"https://api.fanar.qa/v1/audio/voices\"\nheaders = {\n    \"Authorization\": \"Bearer YOUR_API_KEY\"\n}\n\nsample_audio_path = \"custom-voice-sample.wav\"\naudio = AudioSegment.from_wav(sample_audio_path)\nif audio.frame_rate != 24000:\n    audio = audio.set_frame_rate(24000)\n\naudio_buffer = BytesIO()\naudio.export(audio_buffer, format='wav')\naudio_buffer.seek(0)  # Reset buffer position to start\n\nfiles = {'audio': (os.path.basename(sample_audio_path), audio_buffer, 'audio/wav')}\n\ndata = {\n    \"name\": \"CustomVoice1\",\n    \"transcript\": \"This is a sample transcription.\"\n}\n\nrequests.post(url, headers=headers, files=files, data=data)\n"}]}},"/v1/audio/voices/{name}":{"delete":{"tags":["Audio"],"summary":"Delete Voice","description":"Deletes a personalized voice by name.<br/>This endpoint requires additional authorization and is not allowed by default. Please contact <a href='mailto:support@fanar.qa'>support@fanar.qa</a>.","operationId":"delete_voice_v1_audio_voices__name__delete","security":[{"Bearer":[]}],"parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"The content was filtered","content":{"application/json":{"example":{"error":{"code":"content_filter","message":"The content was filtered","status":400,"param":"prompt","type":"safety"}},"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid authentication","content":{"application/json":{"example":{"error":{"code":"invalid_authentication","message":"Invalid authentication","status":401}},"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Invalid authorization","content":{"application/json":{"example":{"error":{"code":"invalid_authorization","message":"Invalid authorization","status":403}},"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit reached or Exceeded quota","content":{"application/json":{"example":{"error":{"code":"exceeded_quota","message":"Exceeded quota","status":429}},"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"example":{"error":{"code":"internal_server_error","message":"Internal server error","status":500}},"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service overloaded","content":{"application/json":{"example":{"error":{"code":"overloaded","message":"Service overloaded","status":503}},"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"Request timed out","content":{"application/json":{"example":{"error":{"code":"timeout","message":"Request timed out","status":504}},"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request entity too large","content":{"application/json":{"example":{"error":{"code":"too_large","message":"Request entity too large","status":413}},"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Unprocessable","content":{"application/json":{"example":{"error":{"code":"unprocessable","message":"Unprocessable","status":422}},"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"example":{"error":{"code":"conflict","message":"Conflict","status":409}},"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"example":{"error":{"code":"Not found","message":"Not found","status":404}},"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"No longer supported","content":{"application/json":{"example":{"error":{"code":"no_longer_supported","message":"No longer supported","status":410}},"schema":{"$ref":"#/components/schemas/Error"}}}},"499":{"description":"Client closed request before completion","content":{"application/json":{"example":{"error":{"code":"client_closed_request","message":"Client closed request before completion","status":499}},"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"Curl","label":"cURL","source":"curl -X DELETE \"https://api.fanar.qa/v1/audio/voices/{name}\" \\\n-H \"Content-Type: application/json\" \\\n-H \"Authorization: Bearer YOUR_API_KEY\"\n"},{"lang":"Python","label":"Python - requests","source":"# Voice personalization requires additional authorization and is not allowed by default.\n\nimport requests\n\nurl = \"https://api.fanar.qa/v1/audio/voices/{name}\"\nheaders = {\n    \"Authorization\": \"Bearer YOUR_API_KEY\",\n    \"Content-Type\": \"application/json\"\n}\nrequests.delete(url, headers=headers)\n"}]}},"/v1/images/generations":{"post":{"tags":["Images"],"summary":"Create Image","description":"This endpoint is compatible with the OpenAI library.<br/>Creates an image given a prompt.","operationId":"create_image_v1_images_generations_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageGenerationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageGenerationResponse"}}}},"400":{"description":"The content was filtered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"content_filter","message":"The content was filtered","status":400,"param":"prompt","type":"safety"}}}}},"401":{"description":"Invalid authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authentication","message":"Invalid authentication","status":401}}}}},"403":{"description":"Invalid authorization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authorization","message":"Invalid authorization","status":403}}}}},"429":{"description":"Rate limit reached or Exceeded quota","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"exceeded_quota","message":"Exceeded quota","status":429}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_server_error","message":"Internal server error","status":500}}}}},"503":{"description":"Service overloaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"overloaded","message":"Service overloaded","status":503}}}}},"504":{"description":"Request timed out","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"timeout","message":"Request timed out","status":504}}}}},"413":{"description":"Request entity too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"too_large","message":"Request entity too large","status":413}}}}},"422":{"description":"Unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unprocessable","message":"Unprocessable","status":422}}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"conflict","message":"Conflict","status":409}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"Not found","message":"Not found","status":404}}}}},"410":{"description":"No longer supported","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"no_longer_supported","message":"No longer supported","status":410}}}}},"499":{"description":"Client closed request before completion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"client_closed_request","message":"Client closed request before completion","status":499}}}}}},"security":[{"Bearer":[]}],"x-codeSamples":[{"lang":"Curl","label":"cURL","source":"curl -X POST \"https://api.fanar.qa/v1/images/generations\" \\\n-H \"Content-Type: application/json\" \\\n-H \"Authorization: Bearer YOUR_API_KEY\" \\\n-d '{\n  \"model\": \"Fanar-Oryx-IG-2\",\n  \"prompt\": \"A serene sunset over a mountain lake with reflections of colorful clouds and pine trees\"\n}'\n"},{"lang":"Python","label":"Python - OpenAI","source":"# Image Generation requires additional authorization and is not allowed by default.\n\nimport base64\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"https://api.fanar.qa/v1\",\n    api_key=\"YOUR_API_KEY\",\n)\n\nresponse = client.images.generate(\n    model=\"Fanar-Oryx-IG-2\",\n    prompt=\"A serene sunset over a mountain lake with reflections of colorful clouds and pine trees\"\n)\n\nimage_b64 = response.data[0].b64_json\n\nimage_bytes = base64.b64decode(image_b64)\n\nwith open(\"generated_image.png\", \"wb\") as f:\n    f.write(image_bytes)\n"},{"lang":"Python - requests","label":"Python - requests","source":"# Image Generation requires additional authorization and is not allowed by default.\n\nimport requests\nimport base64\n\nheaders = {\n    \"Authorization\": \"Bearer YOUR_API_KEY\",\n    \"Content-Type\": \"application/json\",\n}\n\njson_data = {\n    \"model\": \"Fanar-Oryx-IG-2\",\n    \"prompt\": \"A serene sunset over a mountain lake with reflections of colorful clouds and pine trees\"\n}\n\nresponse = requests.post(\n    \"https://api.fanar.qa/v1/images/generations\",\n    headers=headers,\n    json=json_data\n)\n\ndata = response.json()\n\nimage_b64 = data[\"data\"][0][\"b64_json\"]\n\nimage_bytes = base64.b64decode(image_b64)\n\nwith open(\"generated_image.png\", \"wb\") as f:\n    f.write(image_bytes)"}]}},"/v1/translations":{"post":{"tags":["Translations"],"summary":"Translate","description":"Translate the given text into the specified language.","operationId":"translate_v1_translations_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TranslationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TranslationResponse"}}}},"400":{"description":"The content was filtered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"content_filter","message":"The content was filtered","status":400,"param":"prompt","type":"safety"}}}}},"401":{"description":"Invalid authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authentication","message":"Invalid authentication","status":401}}}}},"403":{"description":"Invalid authorization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authorization","message":"Invalid authorization","status":403}}}}},"429":{"description":"Rate limit reached or Exceeded quota","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"exceeded_quota","message":"Exceeded quota","status":429}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_server_error","message":"Internal server error","status":500}}}}},"503":{"description":"Service overloaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"overloaded","message":"Service overloaded","status":503}}}}},"504":{"description":"Request timed out","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"timeout","message":"Request timed out","status":504}}}}},"413":{"description":"Request entity too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"too_large","message":"Request entity too large","status":413}}}}},"422":{"description":"Unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unprocessable","message":"Unprocessable","status":422}}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"conflict","message":"Conflict","status":409}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"Not found","message":"Not found","status":404}}}}},"410":{"description":"No longer supported","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"no_longer_supported","message":"No longer supported","status":410}}}}},"499":{"description":"Client closed request before completion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"client_closed_request","message":"Client closed request before completion","status":499}}}}}},"security":[{"Bearer":[]}],"x-codeSamples":[{"lang":"Curl","label":"cURL","source":"curl -X POST \"https://api.fanar.qa/v1/translations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer YOUR_API_KEY\" \\\n  -d '{\n    \"model\": \"Fanar-Shaheen-MT-2\",\n    \"text\": \"Your text here\",\n    \"langpair\": \"ar-en\",\n    \"preprocessing\": \"default\"\n  }'\n"},{"lang":"Python","label":"Python - requests","source":"# Translation requires additional authorization and is not allowed by default.\n\nimport requests\n\nheaders = {\n    \"Authorization\": \"Bearer YOUR_API_KEY\",\n    \"Content-Type\": \"application/json\",\n}\n\njson_data = {\n    \"model\": \"Fanar-Shaheen-MT-2\",\n    \"text\": \"مرحبا بك في عالم الذكاء الاصطناعي!\",\n    \"langpair\": \"ar-en\",\n    \"preprocessing\": \"default\",\n}\n\nresponse = requests.post(\"https://api.fanar.qa/v1/translations\", headers=headers, json=json_data)\n\nprint(response.json())"}]}},"/v1/poems/generations":{"post":{"tags":["Poems"],"summary":"Create Poem","description":"This endpoint is compatible with the OpenAI library.<br/>Creates a poem given a prompt.","operationId":"create_poem_v1_poems_generations_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PoemGenerationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PoemGenerationResponse"}}}},"400":{"description":"The content was filtered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"content_filter","message":"The content was filtered","status":400,"param":"prompt","type":"safety"}}}}},"401":{"description":"Invalid authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authentication","message":"Invalid authentication","status":401}}}}},"403":{"description":"Invalid authorization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authorization","message":"Invalid authorization","status":403}}}}},"429":{"description":"Rate limit reached or Exceeded quota","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"exceeded_quota","message":"Exceeded quota","status":429}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_server_error","message":"Internal server error","status":500}}}}},"503":{"description":"Service overloaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"overloaded","message":"Service overloaded","status":503}}}}},"504":{"description":"Request timed out","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"timeout","message":"Request timed out","status":504}}}}},"413":{"description":"Request entity too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"too_large","message":"Request entity too large","status":413}}}}},"422":{"description":"Unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unprocessable","message":"Unprocessable","status":422}}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"conflict","message":"Conflict","status":409}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"Not found","message":"Not found","status":404}}}}},"410":{"description":"No longer supported","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"no_longer_supported","message":"No longer supported","status":410}}}}},"499":{"description":"Client closed request before completion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"client_closed_request","message":"Client closed request before completion","status":499}}}}}},"security":[{"Bearer":[]}],"x-codeSamples":[{"lang":"Curl","label":"cURL","source":"curl -X POST \"https://api.fanar.qa/v1/poems/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer YOUR_API_KEY\" \\\n  -d '{\n    \"model\": \"Fanar-Diwan\",\n    \"prompt\": \"Your text here\"\n  }'\n"},{"lang":"Python","label":"Python - requests","source":"# Poem generation requires additional authorization and is not allowed by default.\n\nimport requests\n\nheaders = {\n    \"Authorization\": \"Bearer YOUR_API_KEY\",\n    \"Content-Type\": \"application/json\",\n}\n\njson_data = {\n    \"model\": \"Fanar-Diwan\",\n    \"prompt\": \"Your text here\",\n}\n\nresponse = requests.post(\"https://api.fanar.qa/v1/poems/generations\", headers=headers, json=json_data)\n\nprint(response.json())"}]}},"/v1/moderations":{"post":{"tags":["Moderations"],"summary":"Identify Safety","description":"FanarGuard gives each prompt–response pair safety and cultural-awareness scores, allowing moderation thresholds to be tailored to the deployment.<br/>For our definition of cultural awareness, refer to [https://arxiv.org/abs/2511.18852](https://arxiv.org/abs/2511.18852).","operationId":"identify_safety_v1_moderations_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SafetyFilterRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SafetyFilterResponse"}}}},"401":{"description":"Invalid authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authentication","message":"Invalid authentication","status":401}}}}},"403":{"description":"Invalid authorization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authorization","message":"Invalid authorization","status":403}}}}},"429":{"description":"Rate limit reached or Exceeded quota","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"exceeded_quota","message":"Exceeded quota","status":429}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_server_error","message":"Internal server error","status":500}}}}},"503":{"description":"Service overloaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"overloaded","message":"Service overloaded","status":503}}}}},"504":{"description":"Request timed out","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"timeout","message":"Request timed out","status":504}}}}},"413":{"description":"Request entity too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"too_large","message":"Request entity too large","status":413}}}}},"422":{"description":"Unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unprocessable","message":"Unprocessable","status":422}}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"conflict","message":"Conflict","status":409}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"Not found","message":"Not found","status":404}}}}},"410":{"description":"No longer supported","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"no_longer_supported","message":"No longer supported","status":410}}}}},"499":{"description":"Client closed request before completion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"client_closed_request","message":"Client closed request before completion","status":499}}}}}},"security":[{"Bearer":[]}],"x-codeSamples":[{"lang":"Curl","label":"cURL","source":"curl -X POST \"https://api.fanar.qa/v1/moderations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer YOUR_API_KEY\" \\\n  -d '{\n    \"model\": \"Fanar-Guard-2\",\n    \"prompt\": \"Your prompt here\",\n    \"response\": \"Response from the model here\"\n  }'\n"},{"lang":"Python","label":"Python - requests","source":"import requests\n\nheaders = {\n    \"Authorization\": \"Bearer YOUR_API_KEY\",\n    \"Content-Type\": \"application/json\",\n}\n\njson_data = {\n    \"model\": \"Fanar-Guard-2\",\n    \"prompt\": \"Your prompt here\",\n    \"response\": \"Response from the model here\",\n}\n\nresponse = requests.post(\"https://api.fanar.qa/v1/moderations\", headers=headers, json=json_data)\n\nprint(response.json())  # Print the safety and cultural awareness scores"}]}},"/v1/sadiq/validate":{"post":{"tags":["Sadiq"],"summary":"Validate Text","description":"Detects and verifies Qur'an and hadith quotations inside arbitrary text. Send a block of text — an LLM answer, a user message, an article — and it comes back with the Qur'anic verses and hadith tagged and linked to their canonical sources. Quotations that cannot be confirmed are returned as plain, untagged text, which is the signal callers act on.<br/><br/>Verified Qur'anic verses are replaced with authenticated Quran text wrapped in `<quran_start>` / `<quran_end>` with a `[surah:ayah](quran.com)` markdown reference; verified hadith are wrapped in `<hadith_start>` / `<hadith_end>` with a `[collection:number](sunnah.com)` reference. To render, strip the tags and keep the links.<br/><br/>Example — input:<br/><code>قال الله تعالى: إن الصلاة تنهى عن الفحشاء والمنكر. وقال النبي صلى الله عليه وسلم: إنما الأعمال بالنيات.</code><br/><br/>Output text:<br/><code>قال الله تعالى: &lt;quran_start&gt;ٱتْلُ مَآ أُوحِىَ إِلَيْكَ مِنَ ٱلْكِتَـٰبِ وَأَقِمِ ٱلصَّلَوٰةَ ۖ إِنَّ ٱلصَّلَوٰةَ تَنْهَىٰ عَنِ ٱلْفَحْشَآءِ وَٱلْمُنكَرِ ۗ وَلَذِكْرُ ٱللَّهِ أَكْبَرُ ۗ وَٱللَّهُ يَعْلَمُ مَا تَصْنَعُونَ [٤٥](https://quran.com/29/45)&lt;quran_end&gt; وقال النبي صلى الله عليه وسلم: &lt;hadith_start&gt;إنما الأعمال بالنيات&lt;hadith_end&gt; [riyadussalihin:1](https://sunnah.com/riyadussalihin:1)</code><br/><br/>The partially quoted verse is replaced with the full authenticated ayah and cited; the hadith is tagged and cited. An unverifiable quotation would come back untagged.<br/><br/>This endpoint requires additional authorization and is not allowed by default. Please contact <a href='mailto:support@fanar.qa'>support@fanar.qa</a>.","operationId":"validate_text_v1_sadiq_validate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SadiqValidationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SadiqValidationResponse"}}}},"401":{"description":"Invalid authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authentication","message":"Invalid authentication","status":401}}}}},"403":{"description":"Invalid authorization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authorization","message":"Invalid authorization","status":403}}}}},"429":{"description":"Rate limit reached or Exceeded quota","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"exceeded_quota","message":"Exceeded quota","status":429}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_server_error","message":"Internal server error","status":500}}}}},"503":{"description":"Service overloaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"overloaded","message":"Service overloaded","status":503}}}}},"504":{"description":"Request timed out","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"timeout","message":"Request timed out","status":504}}}}},"413":{"description":"Request entity too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"too_large","message":"Request entity too large","status":413}}}}},"422":{"description":"Unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unprocessable","message":"Unprocessable","status":422}}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"conflict","message":"Conflict","status":409}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"Not found","message":"Not found","status":404}}}}},"410":{"description":"No longer supported","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"no_longer_supported","message":"No longer supported","status":410}}}}},"499":{"description":"Client closed request before completion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"client_closed_request","message":"Client closed request before completion","status":499}}}}}},"security":[{"Bearer":[]}],"x-codeSamples":[{"lang":"Curl","label":"cURL","source":"curl -X POST \"https://api.fanar.qa/v1/sadiq/validate\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer YOUR_API_KEY\" \\\n  -d '{\n    \"model\": \"Fanar-Sadiq-2\",\n    \"text\": \"قال الله تعالى: إن الصلاة تنهى عن الفحشاء والمنكر. وقال النبي صلى الله عليه وسلم: إنما الأعمال بالنيات.\"\n  }'\n"},{"lang":"Python","label":"Python - requests","source":"# Quran & hadith validation requires additional authorization and is not allowed by default.\n\nimport requests\n\nheaders = {\n    \"Authorization\": \"Bearer YOUR_API_KEY\",\n    \"Content-Type\": \"application/json\",\n}\n\njson_data = {\n    \"model\": \"Fanar-Sadiq-2\",\n    \"text\": \"قال الله تعالى: إن الصلاة تنهى عن الفحشاء والمنكر. وقال النبي صلى الله عليه وسلم: إنما الأعمال بالنيات.\",\n}\n\nresponse = requests.post(\"https://api.fanar.qa/v1/sadiq/validate\", headers=headers, json=json_data)\n\nprint(response.json())\n"}]}},"/v1/sadiq/deep-research":{"post":{"tags":["Sadiq"],"summary":"Create Deep Research","description":"A structured research report on an Islamic topic from **Fanar-Sadiq-2**, with headings and cited sources.<br/><br/>**Depth levels:**<br/>- `quick` — single-pass summary, fastest<br/>- `standard` *(default)* — multi-pass, balanced<br/>- `comprehensive` — exhaustive, widest source coverage<br/><br/>**Expected runtime** — minutes, not seconds: about 3-6 min for `quick`, 7-10 min for `standard`, longer for `comprehensive`.<br/><br/>**Background mode (recommended).** Because a run is this long, set `background: true`: the call returns a `Job` at once (its id also in `X-Id`) and the research no longer depends on your connection. Poll `GET /v1/sadiq/deep-research/{id}` for the result, or add `stream: true` to receive its events on this connection, resumable after a drop.<br/><br/>**Without `background`**, one connection is held for the whole run: `stream: true` (default) sends Server-Sent Events ending with the `report`, `stream: false` sends the report as JSON. If you see timeouts or disconnects, switch to background mode.<br/><br/>This endpoint requires additional authorization and is not allowed by default. Please contact <a href='mailto:support@fanar.qa'>support@fanar.qa</a>.","operationId":"create_deep_research_v1_sadiq_deep_research_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeepResearchRequest"}}},"required":true},"responses":{"200":{"description":"A structured report (synchronous, non-streaming), an SSE stream (streaming), or, with `background: true`, a `Job` -- or the job's event stream when `stream` is also true.","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/DeepResearchReport"},{"$ref":"#/components/schemas/Job"}]},"examples":{"report":{"summary":"Synchronous: the report","value":{"topic":"ما أهمية طلب العلم في الإسلام؟","language":"ar","title":"أهمية طلب العلم في الإسلام","title_ar":"أهمية طلب العلم في الإسلام","overview":"هذا التقرير يستعرض أهمية طلب العلم في الإسلام من خلال ثلاثة أقسام رئيسية: ...","sections":[{"heading":"الأساس الديني لطلب العلم","heading_ar":"الأساس الديني لطلب العلم","mode":"general","content":"## الأساس الديني لطلب العلم\n\n### الأدلة الأساسية\n\nيؤكد القرآن الكريم والسنة النبوية على أهمية طلب العلم ...","cited_sources":[{"source":"https://islamweb.net/ar/article/228949/","citation_tag":"[إسلام ويب:228949]","quote":"العِلْمُ نورٌ للعُقولِ، وضِياءٌ للمجتمعات ...","was_cited":true}]}],"sources":[{"source":"https://fiqh.islamonline.net/طلب-العلم-أهميته-وطرق-تحصيله/","citation_tag":"[إسلام أون لاين:943042]","quote":"طلب العلم : أهميته وطرق تحصيله ...","was_cited":true},{"source":"https://islamweb.net/ar/article/228949/","citation_tag":"[إسلام ويب:228949]","quote":"العِلْمُ نورٌ للعُقولِ ...","was_cited":true}],"markdown":"# أهمية طلب العلم في الإسلام\n\n...","metadata":{"depth":"quick","mode":"deep_research","language":"ar","elapsed_seconds":267.32,"sections_count":4,"total_sources":28,"total_queries":5,"web_search_used":false,"web_sources_count":0,"adaptive_planning_used":true,"editorial_polish_applied":true}}},"job":{"summary":"background: true -- the job, queued","value":{"id":"c3869c31-4283-4934-b7d6-18ad35265d70","object":"job","type":"deep_research","status":"queued","progress_pct":0,"attempt":0,"created_at":1791099697,"updated_at":1791099697,"request":{"model":"Fanar-Sadiq-2","input":"ما أهمية طلب العلم في الإسلام؟","depth":"quick","web_search":false}}}}},"text/event-stream":{"schema":{"oneOf":[{"$ref":"#/components/schemas/TokenChunk"},{"$ref":"#/components/schemas/ProgressChunk"},{"$ref":"#/components/schemas/ReportChunk"},{"$ref":"#/components/schemas/DoneChunk"},{"$ref":"#/components/schemas/ErrorChunk"}]},"examples":{"stream":{"summary":"Synchronous stream","value":"data: {\"id\":\"chatcmpl-a46c47\",\"object\":\"chat.completion.chunk\",\"created\":1789987956,\"model\":null,\"progress\":{\"message\":{\"en\":\"Analyzing topic and planning report structure...\",\"ar\":\"تحليل الموضوع وتخطيط هيكل التقرير...\"}}}\n\ndata: {\"id\":\"chatcmpl-a46c47\",\"object\":\"chat.completion.chunk\",\"created\":1789987961,\"model\":\"Fanar-Sadiq-2\",\"progress\":{\"message\":{\"en\":\"Researching: الأساس الديني لطلب العلم...\",\"ar\":\"البحث في: الأساس الديني لطلب العلم...\"}}}\n\ndata: {\"id\":\"chatcmpl-a46c47\",\"object\":\"chat.completion.chunk\",\"created\":1789988100,\"model\":\"Fanar-Sadiq-2\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"يؤكد \"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-a46c47\",\"object\":\"chat.completion.chunk\",\"created\":1789988223,\"model\":\"Fanar-Sadiq-2\",\"report\":{\"title\":\"أهمية طلب العلم في الإسلام\",\"sections\":[...],\"sources\":[...]}}\n\ndata: {\"id\":\"chatcmpl-a46c47\",\"object\":\"chat.completion.chunk\",\"created\":1789988223,\"model\":\"Fanar-Sadiq-2\",\"choices\":[{\"index\":0,\"delta\":{\"references\":null},\"finish_reason\":\"stop\"}],\"metadata\":{\"depth\":\"quick\",\"elapsed_seconds\":267.32,\"total_sources\":28,\"web_search_used\":false}}\n\ndata: [DONE]\n\n"},"job":{"summary":"background + stream: the job's events, each with an id (job id in X-Id)","value":"id: 1791099047115-0\ndata: {\"id\": \"chatcmpl-7d72ef6259e8459cb56ae483\", \"object\": \"chat.completion.chunk\", \"created\": 1791099047, \"model\": null, \"progress\": {\"message\": {\"ar\": \"جاري تحليل الموضوع وتخطيط هيكل التقرير...\", \"en\": \"Analyzing topic and planning report structure...\"}}}\n\nid: 1791099055269-0\ndata: {\"id\": \"chatcmpl-d7f7d15d14394022a808718c\", \"object\": \"chat.completion.chunk\", \"created\": 1791099055, \"model\": null, \"progress\": {\"message\": {\"ar\": \"تم تحديد الخطة: 4 أقسام مخطط لها\", \"en\": \"Report outlined: 4 sections planned\"}}}\n\n"}}}}},"400":{"description":"The content was filtered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"content_filter","message":"The content was filtered","status":400,"param":"prompt","type":"safety"}}}}},"401":{"description":"Invalid authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authentication","message":"Invalid authentication","status":401}}}}},"403":{"description":"Invalid authorization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authorization","message":"Invalid authorization","status":403}}}}},"429":{"description":"Rate limit reached or Exceeded quota","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"exceeded_quota","message":"Exceeded quota","status":429}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_server_error","message":"Internal server error","status":500}}}}},"503":{"description":"Service overloaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"overloaded","message":"Service overloaded","status":503}}}}},"504":{"description":"Request timed out","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"timeout","message":"Request timed out","status":504}}}}},"413":{"description":"Request entity too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"too_large","message":"Request entity too large","status":413}}}}},"422":{"description":"Unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unprocessable","message":"Unprocessable","status":422}}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"conflict","message":"Conflict","status":409}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"Not found","message":"Not found","status":404}}}}},"410":{"description":"No longer supported","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"no_longer_supported","message":"No longer supported","status":410}}}}},"499":{"description":"Client closed request before completion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"client_closed_request","message":"Client closed request before completion","status":499}}}}}},"security":[{"Bearer":[]}],"x-codeSamples":[{"lang":"Curl","label":"cURL - background job","source":"# Deep research requires the sadiq_deep_research feature flag on your API key.\n# `background: true` returns a job at once; the research runs whatever happens to\n# your connection. Poll it with GET /v1/sadiq/deep-research/{id} until it ends.\ncurl -X POST \"https://api.fanar.qa/v1/sadiq/deep-research\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer YOUR_API_KEY_HERE\" \\\n  -d '{\n    \"model\": \"Fanar-Sadiq-2\",\n    \"input\": \"Your research topic here\",\n    \"depth\": \"standard\",\n    \"background\": true\n  }'\n"},{"lang":"cURL - single request","label":"cURL - single request","source":"# A run takes minutes. If it times out or drops, use \"cURL - background job\".\ncurl -X POST \"https://api.fanar.qa/v1/sadiq/deep-research\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer YOUR_API_KEY_HERE\" \\\n  --max-time 1800 \\\n  -d '{\n    \"model\": \"Fanar-Sadiq-2\",\n    \"input\": \"Your research topic here\",\n    \"depth\": \"standard\",\n    \"web_search\": false,\n    \"stream\": false\n  }'\n"},{"lang":"Python","label":"Python - single request","source":"# One blocking call, one report back (~7-10 minutes for `standard`).\n# Seeing timeouts or dropped connections? Use \"Python - background job\".\n\nimport requests\n\nBASE_URL = \"https://api.fanar.qa\"\nAPI_KEY = \"YOUR_API_KEY_HERE\"\n\n\ndef deep_research(topic, depth=\"standard\", web_search=False):\n    response = requests.post(\n        f\"{BASE_URL}/v1/sadiq/deep-research\",\n        headers={\n            \"Authorization\": f\"Bearer {API_KEY}\",\n            \"Content-Type\": \"application/json\",\n        },\n        json={\n            \"model\": \"Fanar-Sadiq-2\",\n            \"input\": topic,\n            \"depth\": depth,\n            \"web_search\": web_search,\n            \"stream\": False,\n        },\n        timeout=1800,\n    )\n    response.raise_for_status()\n    return response.json()\n\n\nreport = deep_research(\"The importance of seeking knowledge in Islam\")\n\nprint(report[\"title\"])\nprint(report[\"overview\"])\nfor section in report.get(\"sections\") or []:\n    print(f\"\\n## {section['heading']}\")\n    print(section[\"content\"])\n# A source is {source, citation_tag, quote, was_cited} -- a URL and its citation tag,\n# not a numbered reference. `quote` is the passage the report drew on.\nfor source in report.get(\"sources\") or []:\n    print(f\"{source.get('citation_tag', '')} {source['source']}\")\n"},{"lang":"Python - streaming","label":"Python - streaming","source":"# Holds one connection for the whole run; for a stream that survives drops, use\n# \"Python - background + stream\". Take the result from the `report` chunk.\n#\n#   {\"progress\": {\"message\": {\"en\": ..., \"ar\": ...}}}   a pass completed\n#   {\"choices\": [{\"delta\": {\"content\": \"...\"}}]}        prose, token by token\n#   {\"report\": {...}}                                   the finished report\n#   {\"choices\": [{\"finish_reason\": \"stop\", ...}]}       usage + references\n#   data: [DONE]                                        end of stream\n\nimport json\n\nimport requests\n\nBASE_URL = \"https://api.fanar.qa\"\nAPI_KEY = \"YOUR_API_KEY_HERE\"\n\n\ndef deep_research_stream(topic, depth=\"standard\", web_search=False):\n    \"\"\"Yield (kind, payload) for each event; kind is progress|delta|report|done.\"\"\"\n    with requests.post(\n        f\"{BASE_URL}/v1/sadiq/deep-research\",\n        headers={\n            \"Authorization\": f\"Bearer {API_KEY}\",\n            \"Content-Type\": \"application/json\",\n        },\n        json={\n            \"model\": \"Fanar-Sadiq-2\",\n            \"input\": topic,\n            \"depth\": depth,\n            \"web_search\": web_search,\n            \"stream\": True,\n        },\n        stream=True,\n        timeout=1800,\n    ) as response:\n        response.raise_for_status()\n\n        for line in response.iter_lines(decode_unicode=True):\n            if not line or not line.startswith(\"data: \"):\n                continue\n            data = line[len(\"data: \"):].strip()\n            if data == \"[DONE]\":\n                break\n            chunk = json.loads(data)\n\n            if \"error\" in chunk:\n                raise RuntimeError(chunk[\"error\"].get(\"message\", \"stream error\"))\n            if \"progress\" in chunk:\n                yield \"progress\", chunk[\"progress\"][\"message\"][\"en\"]\n                continue\n            if \"report\" in chunk:\n                yield \"report\", chunk[\"report\"]\n                continue\n\n            choice = (chunk.get(\"choices\") or [{}])[0]\n            if choice.get(\"finish_reason\"):\n                yield \"done\", chunk\n            elif choice.get(\"delta\", {}).get(\"content\"):\n                yield \"delta\", choice[\"delta\"][\"content\"]\n\n\nreport = None\nfor kind, payload in deep_research_stream(\"The importance of seeking knowledge in Islam\"):\n    if kind == \"progress\":\n        print(f\"... {payload}\")\n    elif kind == \"report\":\n        report = payload\n    elif kind == \"done\":\n        # `metadata` carries the run facts (depth, elapsed_seconds, total_sources,\n        # web_search_used). `usage` is often absent on this endpoint -- do not rely on it.\n        print(f\"\\nmetadata: {payload.get('metadata')}\")\n\nif report:\n    print(report[\"title\"])\n    print(report.get(\"markdown\") or report[\"overview\"])\n"},{"lang":"Python - background job","label":"Python - background job","source":"# Recommended: `background: true` returns a job at once; poll it until it ends.\n\nimport time\n\nimport requests\n\nBASE_URL = \"https://api.fanar.qa\"\nAPI_KEY = \"YOUR_API_KEY_HERE\"\nHEADERS = {\"Authorization\": f\"Bearer {API_KEY}\"}\n\nresponse = requests.post(\n    f\"{BASE_URL}/v1/sadiq/deep-research\",\n    headers=HEADERS,\n    json={\n        \"model\": \"Fanar-Sadiq-2\",\n        \"input\": \"The importance of seeking knowledge in Islam\",\n        \"depth\": \"standard\",\n        \"background\": True,\n    },\n    timeout=30,\n)\nresponse.raise_for_status()\njob = response.json()\nprint(f\"job {job['id']}: {job['status']}\")\n\nwhile job[\"status\"] in (\"queued\", \"in_progress\"):\n    time.sleep(10)\n    job = requests.get(\n        f\"{BASE_URL}/v1/sadiq/deep-research/{job['id']}\", headers=HEADERS, timeout=30\n    ).json()\n    # progress_pct can sit at 100 for a while: the last sentences are still being\n    # checked before the job completes.\n    print(f\"{job['status']} {job['progress_pct']}%\")\n\nif job[\"status\"] == \"completed\":\n    report = job[\"result\"]\n    print(report[\"title\"])\n    print(report.get(\"markdown\") or report[\"overview\"])\nelif job[\"status\"] == \"incomplete\":\n    print(\"stopped by a content filter:\", job[\"incomplete_details\"][\"reason\"])\nelse:  # failed or cancelled\n    raise SystemExit(f\"{job['status']}: {job['error']}\")\n"},{"lang":"TypeScript","label":"TypeScript - background job","source":"// Node 18+ (built-in fetch). Submit in the background and poll until the job ends.\nconst BASE_URL = \"https://api.fanar.qa\";\nconst API_KEY = \"YOUR_API_KEY_HERE\";\nconst headers = { Authorization: `Bearer ${API_KEY}`, \"Content-Type\": \"application/json\" };\n\ntype JobStatus = \"queued\" | \"in_progress\" | \"completed\" | \"failed\" | \"cancelled\" | \"incomplete\";\n\ninterface Job {\n  id: string;\n  status: JobStatus;\n  progress_pct: number;\n  result: { title: string; overview: string; markdown?: string } | null;\n  error: { code: string; message: string } | null;\n  incomplete_details: { reason: string } | null;\n}\n\nasync function call(path: string, init?: RequestInit): Promise<Job> {\n  const res = await fetch(`${BASE_URL}${path}`, { ...init, headers });\n  if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);\n  return (await res.json()) as Job;\n}\n\nasync function main(): Promise<void> {\n  let job = await call(\"/v1/sadiq/deep-research\", {\n    method: \"POST\",\n    body: JSON.stringify({\n      model: \"Fanar-Sadiq-2\",\n      input: \"The importance of seeking knowledge in Islam\",\n      depth: \"standard\",\n      background: true,\n    }),\n  });\n  console.log(`job ${job.id}: ${job.status}`);\n\n  while (job.status === \"queued\" || job.status === \"in_progress\") {\n    await new Promise((resolve) => setTimeout(resolve, 10_000));\n    job = await call(`/v1/sadiq/deep-research/${job.id}`);\n    console.log(`${job.status} ${job.progress_pct}%`);\n  }\n\n  if (job.status === \"completed\" && job.result) {\n    console.log(job.result.title);\n    console.log(job.result.markdown ?? job.result.overview);\n  } else if (job.status === \"incomplete\") {\n    console.log(\"stopped by a content filter:\", job.incomplete_details?.reason);\n  } else {\n    throw new Error(`${job.status}: ${job.error?.message}`);\n  }\n}\n\nmain().catch((err) => {\n  console.error(err.message);\n  process.exit(1);\n});\n"},{"lang":"Python - background + stream","label":"Python - background + stream","source":"# The job's events stream on this connection; its id is in the X-Id header.\n# A response that ends without `data: [DONE]` is resumed from the last event id.\n\nimport json\nimport time\n\nimport requests\n\nBASE_URL = \"https://api.fanar.qa\"\nAPI_KEY = \"YOUR_API_KEY_HERE\"\nHEADERS = {\"Authorization\": f\"Bearer {API_KEY}\"}\n\n\ndef follow(response, state):\n    \"\"\"Read events until [DONE] (True) or the response ends (False).\"\"\"\n    event_id = None\n    for line in response.iter_lines(decode_unicode=True):\n        if line.startswith(\"id: \"):\n            event_id = line[4:]\n        elif line.startswith(\"data: \"):\n            state[\"last_id\"] = event_id\n            data = line[6:]\n            if data == \"[DONE]\":\n                return True\n            chunk = json.loads(data)\n            if \"progress\" in chunk:\n                print(\"...\", chunk[\"progress\"][\"message\"][\"en\"])\n            elif \"report\" in chunk:\n                # Use the report as the result, not the concatenated deltas. If a\n                # worker fails, the job restarts and its events replay from the start\n                # once -- the report is still the one to keep.\n                state[\"report\"] = chunk[\"report\"]\n    return False\n\n\nstate = {\"last_id\": None, \"report\": None}\nwith requests.post(\n    f\"{BASE_URL}/v1/sadiq/deep-research\",\n    headers=HEADERS,\n    json={\n        \"model\": \"Fanar-Sadiq-2\",\n        \"input\": \"The importance of seeking knowledge in Islam\",\n        \"depth\": \"standard\",\n        \"background\": True,\n        \"stream\": True,\n    },\n    stream=True,\n    timeout=(10, 120),  # a keepalive arrives every 15 seconds of quiet\n) as response:\n    response.raise_for_status()\n    job_id = response.headers[\"X-Id\"]\n    try:\n        done = follow(response, state)\n    except requests.RequestException:\n        done = False  # the job does not depend on this connection; resume below\n\nwhile not done:\n    try:\n        with requests.get(\n            f\"{BASE_URL}/v1/sadiq/deep-research/{job_id}\",\n            headers=HEADERS,\n            params={\"stream\": \"true\", \"starting_after\": state[\"last_id\"]},\n            stream=True,\n            timeout=(10, 120),\n        ) as response:\n            response.raise_for_status()\n            done = follow(response, state)\n    except requests.HTTPError as exc:\n        if exc.response.status_code < 500 and exc.response.status_code != 429:\n            raise  # 404: gone or never yours -- stop\n        time.sleep(2)\n    except requests.RequestException:\n        time.sleep(2)  # dropped, mid-event or before connecting: resume from the last id\n\n# The job object is the authoritative outcome: completed, failed, cancelled, incomplete.\njob = requests.get(f\"{BASE_URL}/v1/sadiq/deep-research/{job_id}\", headers=HEADERS, timeout=30).json()\nprint(job[\"status\"])\nif job[\"status\"] == \"completed\":\n    print(job[\"result\"][\"title\"])\n"}]}},"/v1/sadiq/deep-research/{job_id}":{"get":{"tags":["Sadiq"],"summary":"Retrieve Deep Research Job","description":"Returns a background deep research job. `result` holds the report once `status` is `completed`; `incomplete` means a content filter stopped it.<br/><br/>With `stream=true`, returns the job's events as Server-Sent Events, each with an `id:`. `data: [DONE]` ends the job; if a response ends without it, reconnect with `starting_after=<last id>` to resume. Jobs are kept for 24 hours after they end.<br/><br/>This endpoint requires additional authorization and is not allowed by default. Please contact <a href='mailto:support@fanar.qa'>support@fanar.qa</a>.","operationId":"retrieve_deep_research_job_v1_sadiq_deep_research__job_id__get","security":[{"Bearer":[]}],"parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}},{"name":"stream","in":"query","required":false,"schema":{"type":"boolean","description":"Return the job's events as Server-Sent Events instead of the job object.","default":false,"title":"Stream"},"description":"Return the job's events as Server-Sent Events instead of the job object."},{"name":"starting_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"With `stream=true`: resume after this event id (the last `id:` you received).","title":"Starting After"},"description":"With `stream=true`: resume after this event id (the last `id:` you received)."},{"name":"Last-Event-ID","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The standard SSE resume header; `starting_after` takes precedence.","title":"Last-Event-Id"},"description":"The standard SSE resume header; `starting_after` takes precedence."}],"responses":{"200":{"description":"The job (JSON), or with `stream=true` its events (SSE).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"examples":{"in_progress":{"summary":"in_progress","value":{"id":"fda0a674-7494-480d-83ea-0cf12f31dc83","object":"job","type":"deep_research","status":"in_progress","progress_pct":50,"attempt":1,"created_at":1791100381,"started_at":1791100381,"updated_at":1791100422,"request":{"model":"Fanar-Sadiq-2","input":"ما أهمية الصلاة في حياة المسلم؟","depth":"quick","web_search":false}}},"completed":{"summary":"completed, with its report","value":{"id":"5bbed6e2-ae53-486f-823a-2f01992ece59","object":"job","type":"deep_research","status":"completed","progress_pct":100,"attempt":1,"created_at":1791099046,"started_at":1791099046,"completed_at":1791099575,"updated_at":1791099575,"request":{"model":"Fanar-Sadiq-2","input":"ما فضل الصدقة في الإسلام؟","depth":"quick","web_search":false},"result":{"topic":"ما فضل الصدقة في الإسلام؟","language":"ar","title":"فضل الصدقة في الإسلام","title_ar":"فضل الصدقة في الإسلام","overview":"**المقدمة:**\nالصدقة في الإسلام تحمل أهمية روحية واجتماعية عميقة، فهي تُظهر قوة الإيمان وتعكس قيم التعاون والتكافل الاجتماعي. هذا التقرير يستعرض فضائل الصدقة من ...","sections":[{"heading":"الأهمية الروحية والدينية للصدقة","heading_ar":"الأهمية الروحية والدينية للصدقة","content":"## الأهمية الروحية والدينية للصدقة\n\nللصدقة مكانة عظيمة في الإسلام، فهي تعكس صدق إيمان المسلم، حيث أن حب المال فطرة بشرية، ومن يتبرع بماله يكون بذلك قد تجاوز طبي ...","mode":"general","sources":[{"quote":"فنزلت: الَّذِينَ يَلْمِزُونَ الْمُطَّوِّعِينَ مِنَ الْمُؤْمِنِينَ فِي الصَّدَقات ...","source":"نضرة النعيم في مكارم أخلاق الرسول الكريم [3243] - مجموعة من المؤلفين","was_cited":true,"citation_tag":"[الشاملة:3243]"}],"cited_sources":[{"quote":"فنزلت: الَّذِينَ يَلْمِزُونَ الْمُطَّوِّعِينَ مِنَ الْمُؤْمِنِينَ فِي الصَّدَقات ...","source":"نضرة النعيم في مكارم أخلاق الرسول الكريم [3243] - مجموعة من المؤلفين","was_cited":true,"citation_tag":"[الشاملة:3243]"}]}],"sources":[{"quote":"فنزلت: الَّذِينَ يَلْمِزُونَ الْمُطَّوِّعِينَ مِنَ الْمُؤْمِنِينَ فِي الصَّدَقات ...","source":"نضرة النعيم في مكارم أخلاق الرسول الكريم [3243] - مجموعة من المؤلفين","was_cited":true,"citation_tag":"[الشاملة:3243]"},{"quote":"للصدقة شأن عظيم في الإسلام، فهي من أوضح الدلالات، وأصدق العلامات على صدق إيمان ا ...","source":"https://islamweb.net/ar/article/42149/فضائل-الصدقة","was_cited":true,"citation_tag":"[إسلام ويب:42149]"}],"metadata":{"depth":"quick","total_queries":5,"total_sources":24,"sections_count":4,"elapsed_seconds":468.65,"web_search_used":false,"web_sources_count":0,"adaptive_planning_used":false,"editorial_polish_applied":true},"markdown":"# فضل الصدقة في الإسلام\n\n**المقدمة:**\nالصدقة في الإسلام تحمل أهمية روحية واجتماعية عميقة، فهي تُظهر قوة الإيمان وتعكس قي ..."}}},"incomplete":{"summary":"incomplete: stopped by a content filter","value":{"id":"fda0a674-7494-480d-83ea-0cf12f31dc83","object":"job","type":"deep_research","status":"incomplete","incomplete_details":{"reason":"content_filter"},"progress_pct":50,"attempt":1,"created_at":1791100381,"started_at":1791100381,"completed_at":1791100692,"updated_at":1791100692,"request":{"model":"Fanar-Sadiq-2","input":"ما أهمية الصلاة في حياة المسلم؟","depth":"quick","web_search":false}}},"queued":{"summary":"queued","value":{"id":"c3869c31-4283-4934-b7d6-18ad35265d70","object":"job","type":"deep_research","status":"queued","progress_pct":0,"attempt":0,"created_at":1791099697,"updated_at":1791099697,"request":{"model":"Fanar-Sadiq-2","input":"ما أهمية طلب العلم في الإسلام؟","depth":"quick","web_search":false}}}}},"text/event-stream":{"examples":{"from_start":{"summary":"?stream=true -- from the first event","value":"id: 1791099047115-0\ndata: {\"id\": \"chatcmpl-7d72ef6259e8459cb56ae483\", \"object\": \"chat.completion.chunk\", \"created\": 1791099047, \"model\": null, \"progress\": {\"message\": {\"ar\": \"جاري تحليل الموضوع وتخطيط هيكل التقرير...\", \"en\": \"Analyzing topic and planning report structure...\"}}}\n\nid: 1791099077710-0\ndata: {\"id\": \"chatcmpl-1791099046\", \"object\": \"chat.completion.chunk\", \"created\": 1791099046, \"model\": \"Fanar-Sadiq-2\", \"choices\": [{\"index\": 0, \"delta\": {\"role\": \"assistant\"}, \"finish_reason\": null}]}\n\nid: 1791099077711-0\ndata: {\"id\": \"chatcmpl-1791099046\", \"object\": \"chat.completion.chunk\", \"created\": 1791099046, \"model\": \"Fanar-Sadiq-2\", \"choices\": [{\"index\": 0, \"delta\": {\"content\": \"# فضل الصدقة في الإسلام\\n\\n**المقدمة:**\\nالصدقة في الإسلام تحمل أهمية روحية واجتماعية عميقة، فهي تُظهر قوة الإيمان وتعكس قيم التعاون والتكافل الاجتماعي.\"}, \"finish_reason\": null}]}\n\nid: 1791099077744-0\ndata: {\"id\": \"chatcmpl-1791099046\", \"object\": \"chat.completion.chunk\", \"created\": 1791099046, \"model\": \"Fanar-Sadiq-2\", \"progress\": {\"message\": {\"ar\": \"اكتملت النظرة العامة\", \"en\": \"Overview complete\"}}}\n\nid: 1791099575053-0\ndata: {\"id\": \"chatcmpl-1791099046\", \"object\": \"chat.completion.chunk\", \"created\": 1791099046, \"model\": \"Fanar-Sadiq-2\", \"report\": {\"title\": \"فضل الصدقة في الإسلام\", \"sections\": [...], \"sources\": [...]}}\n\nid: 1791099575097-0\ndata: {\"id\": \"chatcmpl-1791099046\", \"object\": \"chat.completion.chunk\", \"created\": 1791099046, \"model\": \"Fanar-Sadiq-2\", \"choices\": [{\"index\": 0, \"delta\": {\"references\": [{\"index\": 0, \"number\": 1, \"source\": \"https://fiqh.islamonline.net/%d8%a3%d8%af%d9%84%d8%a9-%d8%a7%d9%84%d8%aa%d9%83%d8%a7%d9%81%d9%84-%d8%a7%d9%84%d8%a7%d8%ac%d8%aa%d9%85%d8%a7%d8%b9%d9%8a-%d9%81%d9%8a-%d8%a7%d9%84%d8%a5%d8%b3%d9%84%d8%a7%d9%85/\", \"content\": \"أدلة التكافل الاجتماعي في الإسلام: يؤسس الإسلام العلاقات الاجتماعية بين الناس عل ...\", \"citation_tag\": \"[إسلام أون لاين:518085]\", \"was_cited\": true}, ...]}, \"finish_reason\": \"stop\"}], \"metadata\": {\"depth\": \"quick\", \"elapsed_seconds\": 468.65, \"total_sources\": 24, \"web_search_used\": false}}\n\nid: 1791099575102-0\ndata: [DONE]\n\n"},"resumed":{"summary":"?stream=true&starting_after=<id> -- resumed","value":"GET /v1/sadiq/deep-research/5bbed6e2-ae53-486f-823a-2f01992ece59?stream=true&starting_after=1791099077711-0\n\nid: 1791099077744-0\ndata: {\"id\": \"chatcmpl-1791099046\", \"object\": \"chat.completion.chunk\", \"created\": 1791099046, \"model\": \"Fanar-Sadiq-2\", \"progress\": {\"message\": {\"ar\": \"اكتملت النظرة العامة\", \"en\": \"Overview complete\"}}}\n\nid: 1791099077745-0\ndata: {\"id\": \"chatcmpl-1791099046\", \"object\": \"chat.completion.chunk\", \"created\": 1791099046, \"model\": \"Fanar-Sadiq-2\", \"progress\": {\"message\": {\"ar\": \"جاري البحث في الأقسام الأولية (2 من 4)...\", \"en\": \"Researching initial sections (2 of 4)...\"}}}\n\n: keepalive\n\n"}},"schema":{"oneOf":[{"$ref":"#/components/schemas/TokenChunk"},{"$ref":"#/components/schemas/ProgressChunk"},{"$ref":"#/components/schemas/ReportChunk"},{"$ref":"#/components/schemas/DoneChunk"},{"$ref":"#/components/schemas/ErrorChunk"}]}}}},"401":{"description":"Invalid authentication","content":{"application/json":{"example":{"error":{"code":"invalid_authentication","message":"Invalid authentication","status":401}},"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Invalid authorization","content":{"application/json":{"example":{"error":{"code":"invalid_authorization","message":"Invalid authorization","status":403}},"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit reached or Exceeded quota","content":{"application/json":{"example":{"error":{"code":"exceeded_quota","message":"Exceeded quota","status":429}},"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"example":{"error":{"code":"internal_server_error","message":"Internal server error","status":500}},"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service overloaded","content":{"application/json":{"example":{"error":{"code":"overloaded","message":"Service overloaded","status":503}},"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"Request timed out","content":{"application/json":{"example":{"error":{"code":"timeout","message":"Request timed out","status":504}},"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request entity too large","content":{"application/json":{"example":{"error":{"code":"too_large","message":"Request entity too large","status":413}},"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Unprocessable","content":{"application/json":{"example":{"error":{"code":"unprocessable","message":"Unprocessable","status":422}},"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"example":{"error":{"code":"conflict","message":"Conflict","status":409}},"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such job: unknown, created under a different access, or past its 24-hour retention.","content":{"application/json":{"example":{"error":{"code":"Not found","message":"No job found with this id.","status":404}}}}},"410":{"description":"No longer supported","content":{"application/json":{"example":{"error":{"code":"no_longer_supported","message":"No longer supported","status":410}},"schema":{"$ref":"#/components/schemas/Error"}}}},"499":{"description":"Client closed request before completion","content":{"application/json":{"example":{"error":{"code":"client_closed_request","message":"Client closed request before completion","status":499}},"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"Curl","label":"cURL - poll","source":"# The job, as JSON. Poll every few seconds until `status` is completed, failed,\n# cancelled or incomplete. Reading a job is not metered.\ncurl \"https://api.fanar.qa/v1/sadiq/deep-research/YOUR_JOB_ID\" \\\n  -H \"Authorization: Bearer YOUR_API_KEY_HERE\"\n"},{"lang":"cURL - stream","label":"cURL - stream","source":"# The job's events. Omit starting_after to start from the first event; pass the last\n# `id:` you received to resume. `data: [DONE]` is the end of the job; a response that\n# ends without it is resumed the same way.\ncurl -N \"https://api.fanar.qa/v1/sadiq/deep-research/YOUR_JOB_ID?stream=true&starting_after=LAST_EVENT_ID\" \\\n  -H \"Authorization: Bearer YOUR_API_KEY_HERE\"\n"},{"lang":"Python","label":"Python - poll until done","source":"import time\n\nimport requests\n\nBASE_URL = \"https://api.fanar.qa\"\nAPI_KEY = \"YOUR_API_KEY_HERE\"\nJOB_ID = \"YOUR_JOB_ID\"  # the `id` from the create call, also its X-Id header\n\n\ndef wait_for(job_id, every=10):\n    while True:\n        response = requests.get(\n            f\"{BASE_URL}/v1/sadiq/deep-research/{job_id}\",\n            headers={\"Authorization\": f\"Bearer {API_KEY}\"},\n            timeout=30,\n        )\n        if response.status_code == 404:\n            # Unknown, created under a different access, or past its 24-hour retention.\n            raise SystemExit(\"no such job\")\n        response.raise_for_status()\n        job = response.json()\n        if job[\"status\"] not in (\"queued\", \"in_progress\"):\n            return job\n        print(f\"{job['status']} {job['progress_pct']}% (attempt {job['attempt']})\")\n        time.sleep(every)\n\n\njob = wait_for(JOB_ID)\nif job[\"status\"] == \"completed\":\n    print(job[\"result\"][\"title\"])\nelif job[\"status\"] == \"incomplete\":\n    # The output was stopped by a content filter; there is no result.\n    print(\"incomplete:\", job[\"incomplete_details\"][\"reason\"])\nelif job[\"status\"] == \"cancelled\":\n    print(\"cancelled by\", job[\"cancel_source\"])\nelse:  # failed\n    print(\"failed:\", job[\"error\"][\"code\"], job[\"error\"][\"message\"])\n"},{"lang":"Python - stream with resume","label":"Python - stream with resume","source":"# Follow a job's events to the end, from its first event, surviving any number of\n# dropped or closed connections. Each event's `id:` is a resume point.\n\nimport json\nimport time\n\nimport requests\n\nBASE_URL = \"https://api.fanar.qa\"\nAPI_KEY = \"YOUR_API_KEY_HERE\"\nJOB_ID = \"YOUR_JOB_ID\"\n\n\ndef events(job_id, after):\n    \"\"\"(id, payload) for each event after `after`, until the response ends.\"\"\"\n    with requests.get(\n        f\"{BASE_URL}/v1/sadiq/deep-research/{job_id}\",\n        headers={\"Authorization\": f\"Bearer {API_KEY}\"},\n        params={\"stream\": \"true\", \"starting_after\": after},\n        stream=True,\n        timeout=(10, 120),  # a keepalive arrives every 15 seconds of quiet\n    ) as response:\n        response.raise_for_status()\n        event_id = None\n        for line in response.iter_lines(decode_unicode=True):\n            if line.startswith(\"id: \"):\n                event_id = line[4:]\n            elif line.startswith(\"data: \"):\n                yield event_id, line[6:]\n\n\nlast_id, report, done = None, None, False\nwhile not done:\n    try:\n        for event_id, data in events(JOB_ID, last_id):\n            last_id = event_id\n            if data == \"[DONE]\":\n                done = True\n                break\n            chunk = json.loads(data)\n            if \"progress\" in chunk:\n                print(\"...\", chunk[\"progress\"][\"message\"][\"en\"])\n            elif \"report\" in chunk:\n                report = chunk[\"report\"]  # the result to keep\n            elif \"error\" in chunk:\n                print(\"error:\", chunk[\"error\"].get(\"message\"))\n    except requests.HTTPError as exc:\n        # 404: unknown, created under a different access, or past retention -- stop.\n        if exc.response.status_code < 500 and exc.response.status_code != 429:\n            raise\n        time.sleep(2)\n    except requests.RequestException:\n        # Dropped, mid-event or before connecting: resume from the last id.\n        time.sleep(2)\n    # Fell out without [DONE]: the server closed this response on purpose. Resume.\n\nprint(report[\"title\"] if report else \"no report (see the job's status)\")\n"},{"lang":"TypeScript","label":"TypeScript - stream with resume","source":"// Node 18+ (built-in fetch). Follow a job's events to the end, resuming from the last\n// event id after every closed or dropped connection.\nconst BASE_URL = \"https://api.fanar.qa\";\nconst API_KEY = \"YOUR_API_KEY_HERE\";\nconst JOB_ID = \"YOUR_JOB_ID\";\nconst headers = { Authorization: `Bearer ${API_KEY}` };\n\nclass Fatal extends Error {}\n\ninterface Chunk {\n  progress?: { message: { en: string } };\n  report?: { title: string };\n  error?: { message?: string };\n}\n\n// One response. True on [DONE]; false when it ends without it (resume).\nasync function readSegment(state: { lastId: string | null }, onChunk: (c: Chunk) => void): Promise<boolean> {\n  const url = new URL(`${BASE_URL}/v1/sadiq/deep-research/${JOB_ID}`);\n  url.searchParams.set(\"stream\", \"true\");\n  if (state.lastId) url.searchParams.set(\"starting_after\", state.lastId);\n  const res = await fetch(url, { headers });\n  if (res.status >= 400 && res.status < 500 && res.status !== 429) {\n    throw new Fatal(`HTTP ${res.status}: ${await res.text()}`); // e.g. 404: unknown job\n  }\n  if (!res.ok || !res.body) throw new Error(`HTTP ${res.status}`);\n\n  const decoder = new TextDecoder();\n  let buffer = \"\";\n  for await (const bytes of res.body as unknown as AsyncIterable<Uint8Array>) {\n    buffer += decoder.decode(bytes, { stream: true });\n    let end: number;\n    while ((end = buffer.indexOf(\"\\n\\n\")) !== -1) {\n      const block = buffer.slice(0, end);\n      buffer = buffer.slice(end + 2);\n      let id: string | null = null;\n      let data: string | null = null;\n      for (const line of block.split(\"\\n\")) {\n        if (line.startsWith(\"id: \")) id = line.slice(4);\n        else if (line.startsWith(\"data: \")) data = line.slice(6);\n      }\n      if (data === null) continue; // keepalive\n      state.lastId = id ?? state.lastId;\n      if (data === \"[DONE]\") return true;\n      onChunk(JSON.parse(data) as Chunk);\n    }\n  }\n  return false;\n}\n\nasync function follow(): Promise<void> {\n  const state = { lastId: null as string | null };\n  let report: Chunk[\"report\"] | null = null;\n  const onChunk = (chunk: Chunk) => {\n    if (chunk.progress) console.log(\"...\", chunk.progress.message.en);\n    else if (chunk.report) report = chunk.report; // the result to keep\n    else if (chunk.error) console.log(\"error:\", chunk.error.message);\n  };\n  for (;;) {\n    try {\n      if (await readSegment(state, onChunk)) break;\n    } catch (err) {\n      if (err instanceof Fatal) throw err;\n      await new Promise((resolve) => setTimeout(resolve, 2000));\n    }\n  }\n  console.log(report ? (report as { title: string }).title : \"no report (see the job's status)\");\n}\n\nfollow().catch((err) => {\n  console.error(err.message);\n  process.exit(1);\n});\n"}]}},"/v1/sadiq/deep-research/{job_id}/cancel":{"post":{"tags":["Sadiq"],"summary":"Cancel Deep Research Job","description":"Cancels a background deep research job and returns it. Cancellation is asynchronous: poll until `cancelled`. A job that already ended is returned unchanged. Quota is not refunded.<br/><br/>This endpoint requires additional authorization and is not allowed by default. Please contact <a href='mailto:support@fanar.qa'>support@fanar.qa</a>.","operationId":"cancel_deep_research_job_v1_sadiq_deep_research__job_id__cancel_post","security":[{"Bearer":[]}],"parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"The job as it stands after the cancel.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"examples":{"cancelled":{"summary":"cancelled","value":{"id":"c3869c31-4283-4934-b7d6-18ad35265d70","object":"job","type":"deep_research","status":"cancelled","progress_pct":0,"attempt":0,"created_at":1791099697,"completed_at":1791099697,"updated_at":1791099697,"cancel_source":"owner","request":{"model":"Fanar-Sadiq-2","input":"ما أهمية طلب العلم في الإسلام؟","depth":"quick","web_search":false}}},"too_late":{"summary":"already finished: returned unchanged","value":{"id":"5bbed6e2-ae53-486f-823a-2f01992ece59","object":"job","type":"deep_research","status":"completed","progress_pct":100,"attempt":1,"created_at":1791099046,"started_at":1791099046,"completed_at":1791099575,"updated_at":1791099575,"request":{"model":"Fanar-Sadiq-2","input":"ما فضل الصدقة في الإسلام؟","depth":"quick","web_search":false},"result":{"topic":"ما فضل الصدقة في الإسلام؟","language":"ar","title":"فضل الصدقة في الإسلام","title_ar":"فضل الصدقة في الإسلام","overview":"**المقدمة:**\nالصدقة في الإسلام تحمل أهمية روحية واجتماعية عميقة، فهي تُظهر قوة الإيمان وتعكس قيم التعاون والتكافل الاجتماعي. هذا التقرير يستعرض فضائل الصدقة من ...","sections":[{"heading":"الأهمية الروحية والدينية للصدقة","heading_ar":"الأهمية الروحية والدينية للصدقة","content":"## الأهمية الروحية والدينية للصدقة\n\nللصدقة مكانة عظيمة في الإسلام، فهي تعكس صدق إيمان المسلم، حيث أن حب المال فطرة بشرية، ومن يتبرع بماله يكون بذلك قد تجاوز طبي ...","mode":"general","sources":[{"quote":"فنزلت: الَّذِينَ يَلْمِزُونَ الْمُطَّوِّعِينَ مِنَ الْمُؤْمِنِينَ فِي الصَّدَقات ...","source":"نضرة النعيم في مكارم أخلاق الرسول الكريم [3243] - مجموعة من المؤلفين","was_cited":true,"citation_tag":"[الشاملة:3243]"}],"cited_sources":[{"quote":"فنزلت: الَّذِينَ يَلْمِزُونَ الْمُطَّوِّعِينَ مِنَ الْمُؤْمِنِينَ فِي الصَّدَقات ...","source":"نضرة النعيم في مكارم أخلاق الرسول الكريم [3243] - مجموعة من المؤلفين","was_cited":true,"citation_tag":"[الشاملة:3243]"}]}],"sources":[{"quote":"فنزلت: الَّذِينَ يَلْمِزُونَ الْمُطَّوِّعِينَ مِنَ الْمُؤْمِنِينَ فِي الصَّدَقات ...","source":"نضرة النعيم في مكارم أخلاق الرسول الكريم [3243] - مجموعة من المؤلفين","was_cited":true,"citation_tag":"[الشاملة:3243]"},{"quote":"للصدقة شأن عظيم في الإسلام، فهي من أوضح الدلالات، وأصدق العلامات على صدق إيمان ا ...","source":"https://islamweb.net/ar/article/42149/فضائل-الصدقة","was_cited":true,"citation_tag":"[إسلام ويب:42149]"}],"metadata":{"depth":"quick","total_queries":5,"total_sources":24,"sections_count":4,"elapsed_seconds":468.65,"web_search_used":false,"web_sources_count":0,"adaptive_planning_used":false,"editorial_polish_applied":true},"markdown":"# فضل الصدقة في الإسلام\n\n**المقدمة:**\nالصدقة في الإسلام تحمل أهمية روحية واجتماعية عميقة، فهي تُظهر قوة الإيمان وتعكس قي ..."}}}}}}},"401":{"description":"Invalid authentication","content":{"application/json":{"example":{"error":{"code":"invalid_authentication","message":"Invalid authentication","status":401}},"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Invalid authorization","content":{"application/json":{"example":{"error":{"code":"invalid_authorization","message":"Invalid authorization","status":403}},"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit reached or Exceeded quota","content":{"application/json":{"example":{"error":{"code":"exceeded_quota","message":"Exceeded quota","status":429}},"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"example":{"error":{"code":"internal_server_error","message":"Internal server error","status":500}},"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service overloaded","content":{"application/json":{"example":{"error":{"code":"overloaded","message":"Service overloaded","status":503}},"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"Request timed out","content":{"application/json":{"example":{"error":{"code":"timeout","message":"Request timed out","status":504}},"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request entity too large","content":{"application/json":{"example":{"error":{"code":"too_large","message":"Request entity too large","status":413}},"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Unprocessable","content":{"application/json":{"example":{"error":{"code":"unprocessable","message":"Unprocessable","status":422}},"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"example":{"error":{"code":"conflict","message":"Conflict","status":409}},"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such job: unknown, created under a different access, or past its 24-hour retention.","content":{"application/json":{"example":{"error":{"code":"Not found","message":"No job found with this id.","status":404}}}}},"410":{"description":"No longer supported","content":{"application/json":{"example":{"error":{"code":"no_longer_supported","message":"No longer supported","status":410}},"schema":{"$ref":"#/components/schemas/Error"}}}},"499":{"description":"Client closed request before completion","content":{"application/json":{"example":{"error":{"code":"client_closed_request","message":"Client closed request before completion","status":499}},"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"Curl","label":"cURL","source":"# Idempotent: cancelling a finished job returns it unchanged. Quota is not refunded.\ncurl -X POST \"https://api.fanar.qa/v1/sadiq/deep-research/YOUR_JOB_ID/cancel\" \\\n  -H \"Authorization: Bearer YOUR_API_KEY_HERE\"\n"},{"lang":"Python","label":"Python - cancel and confirm","source":"# Cancellation is asynchronous, and a job already finishing may complete anyway:\n# check the status you end with.\n\nimport time\n\nimport requests\n\nBASE_URL = \"https://api.fanar.qa\"\nAPI_KEY = \"YOUR_API_KEY_HERE\"\nHEADERS = {\"Authorization\": f\"Bearer {API_KEY}\"}\nJOB_ID = \"YOUR_JOB_ID\"\n\njob = requests.post(\n    f\"{BASE_URL}/v1/sadiq/deep-research/{JOB_ID}/cancel\", headers=HEADERS, timeout=30\n).json()\n\nwhile job[\"status\"] in (\"queued\", \"in_progress\"):\n    time.sleep(1)\n    job = requests.get(\n        f\"{BASE_URL}/v1/sadiq/deep-research/{JOB_ID}\", headers=HEADERS, timeout=30\n    ).json()\n\nif job[\"status\"] == \"cancelled\":\n    print(\"cancelled\")\nelse:\n    print(f\"finished before the cancel landed: {job['status']}\")\n"},{"lang":"TypeScript","label":"TypeScript - cancel and confirm","source":"// Node 18+. Cancellation is asynchronous, and a job already finishing may complete\n// anyway: check the status you end with.\nconst BASE_URL = \"https://api.fanar.qa\";\nconst API_KEY = \"YOUR_API_KEY_HERE\";\nconst JOB_ID = \"YOUR_JOB_ID\";\nconst headers = { Authorization: `Bearer ${API_KEY}` };\n\ninterface Job { id: string; status: string }\n\nasync function call(path: string, method = \"GET\"): Promise<Job> {\n  const res = await fetch(`${BASE_URL}${path}`, { method, headers });\n  if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);\n  return (await res.json()) as Job;\n}\n\nasync function main(): Promise<void> {\n  let job = await call(`/v1/sadiq/deep-research/${JOB_ID}/cancel`, \"POST\");\n  while (job.status === \"queued\" || job.status === \"in_progress\") {\n    await new Promise((resolve) => setTimeout(resolve, 1000));\n    job = await call(`/v1/sadiq/deep-research/${JOB_ID}`);\n  }\n  console.log(job.status === \"cancelled\" ? \"cancelled\" : `finished before the cancel landed: ${job.status}`);\n}\n\nmain().catch((err) => {\n  console.error(err.message);\n  process.exit(1);\n});\n"}]}},"/v1/tokens":{"post":{"tags":["Tokens"],"summary":"Get Tokens","operationId":"get_tokens_v1_tokens_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenizationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenizationResponse"}}}},"401":{"description":"Invalid authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authentication","message":"Invalid authentication","status":401}}}}},"403":{"description":"Invalid authorization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authorization","message":"Invalid authorization","status":403}}}}},"429":{"description":"Rate limit reached or Exceeded quota","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"exceeded_quota","message":"Exceeded quota","status":429}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_server_error","message":"Internal server error","status":500}}}}},"503":{"description":"Service overloaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"overloaded","message":"Service overloaded","status":503}}}}},"504":{"description":"Request timed out","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"timeout","message":"Request timed out","status":504}}}}},"413":{"description":"Request entity too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"too_large","message":"Request entity too large","status":413}}}}},"422":{"description":"Unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unprocessable","message":"Unprocessable","status":422}}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"conflict","message":"Conflict","status":409}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"Not found","message":"Not found","status":404}}}}},"410":{"description":"No longer supported","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"no_longer_supported","message":"No longer supported","status":410}}}}},"499":{"description":"Client closed request before completion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"client_closed_request","message":"Client closed request before completion","status":499}}}}}},"security":[{"Bearer":[]}],"x-codeSamples":[{"lang":"Curl","label":"cURL","source":"curl -X POST \"https://api.fanar.qa/v1/tokens\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer YOUR_API_KEY\" \\\n  -d '{\n    \"content\": \"Your text content here\",\n    \"model\": \"Fanar-C-1-8.7B\"\n  }'\n"},{"lang":"Python","label":"Python - requests","source":"import requests\n\nheaders = {\n    \"Authorization\": \"Bearer YOUR_API_KEY\",\n    \"Content-Type\": \"application/json\",\n}\n\njson_data = {\n    \"content\": \"Your text content here\",\n    \"model\": \"Fanar-C-1-8.7B\"\n}\n\nresponse = requests.post(\"https://api.fanar.qa/v1/tokens\", headers=headers, json=json_data)\n\nprint(response.json())"}]}},"/v1/models":{"get":{"tags":["Models"],"summary":"List Models","description":"Lists the currently available models.","operationId":"list_models_v1_models_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelsResponse"}}}},"400":{"description":"The content was filtered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"content_filter","message":"The content was filtered","status":400,"param":"prompt","type":"safety"}}}}},"401":{"description":"Invalid authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authentication","message":"Invalid authentication","status":401}}}}},"403":{"description":"Invalid authorization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_authorization","message":"Invalid authorization","status":403}}}}},"429":{"description":"Rate limit reached or Exceeded quota","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"exceeded_quota","message":"Exceeded quota","status":429}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_server_error","message":"Internal server error","status":500}}}}},"503":{"description":"Service overloaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"overloaded","message":"Service overloaded","status":503}}}}},"504":{"description":"Request timed out","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"timeout","message":"Request timed out","status":504}}}}},"413":{"description":"Request entity too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"too_large","message":"Request entity too large","status":413}}}}},"422":{"description":"Unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unprocessable","message":"Unprocessable","status":422}}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"conflict","message":"Conflict","status":409}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"Not found","message":"Not found","status":404}}}}},"410":{"description":"No longer supported","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"no_longer_supported","message":"No longer supported","status":410}}}}},"499":{"description":"Client closed request before completion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"client_closed_request","message":"Client closed request before completion","status":499}}}}}},"security":[{"Bearer":[]}],"x-codeSamples":[{"lang":"Curl","label":"cURL","source":"curl -X GET \"https://api.fanar.qa/v1/models\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer YOUR_API_KEY\"\n"},{"lang":"Python","label":"Python - requests","source":"import requests\n\nheaders = {\n    \"Authorization\": \"Bearer YOUR_API_KEY\",\n    \"Content-Type\": \"application/json\",\n}\n\nresponse = requests.get(\"https://api.fanar.qa/v1/models\", headers=headers)\n\nprint(response.json())"}]}}},"components":{"schemas":{"AvailableModel":{"properties":{"id":{"type":"string","title":"Id","description":"A unique identifier for the model."},"object":{"$ref":"#/components/schemas/ModelObject","description":"The type of object."},"created":{"type":"integer","title":"Created","description":"The creation timestamp of the model."},"owned_by":{"type":"string","title":"Owned By","description":"The owner of the model."}},"type":"object","required":["id","object","created","owned_by"],"title":"AvailableModel"},"Body_create_transcription_v1_audio_transcriptions_post":{"properties":{"file":{"type":"string","format":"binary","title":"File","description":"The audio blob to transcribe."},"model":{"$ref":"#/components/schemas/STTModels","description":"The model to use for the speech-to-text.\n- `Fanar-Aura-STT-1`: For short audio clips (up to 20–30 seconds).\n- `Fanar-Aura-STT-LF-1`: For long-form transcription of longer audio files."},"format":{"$ref":"#/components/schemas/STTFormat","description":"The format of the transcribed text. `Fanar-Aura-STT-1` only supports `text` format.\n- `text`: Plain text format.\n- `srt`: SubRip Subtitle format.\n- `json`: JSON format with detailed transcription data.","default":"text"}},"type":"object","required":["file","model"],"title":"Body_create_transcription_v1_audio_transcriptions_post"},"Body_create_voice_v1_audio_voices_post":{"properties":{"name":{"type":"string","title":"Name","description":"The name of the personalized voice to be created."},"audio":{"type":"string","format":"binary","title":"Audio","description":"The audio sample to create the personalized voice. Only WAV format is accepted."},"transcript":{"type":"string","title":"Transcript","description":"The transcript of the audio sample."}},"type":"object","required":["name","audio","transcript"],"title":"Body_create_voice_v1_audio_voices_post"},"BookNamesEnum":{"type":"string","enum":["أصل الزراري شرح صحيح البخاري - مخطوط","جمهرة تراجم الفقهاء المالكية","مختصر تحفة المحتاج بشرح المنهاج","شرح رياض الصالحين - حطيبة","تفسير العثيمين: الزمر","الموسوعة في صحيح السيرة النبوية - العهد المكي","تيسير التفسير للقطان","تفسير العثيمين: السجدة","شرح زاد المستقنع - الشنقيطي - التفريغ","تقويم طرق تعليم القرآن الكريم في مراحل التعليم العام والتعليم الجامعي","شرح الورقات في أصول الفقه - الددو","السراج الوهاج","معلم التجويد","فتح القدير للكمال بن الهمام - ط الحلبي","دلائل الإعجاز بين أبي سعيد السيرافي والجرجاني","معلمة الفقه المالكي","الفرائض","غزوات النبي","فقه السيرة النبوية لمنير الغضبان","شرح صحيح مسلم - حسن أبو الأشبال","رسالة ابن القيم إلى أحد إخوانه - ط الشرق الأوسط","مجموع فتاوى ورسائل العثيمين","حاشية البجيرمي على الخطيب = تحفة الحبيب على شرح الخطيب","جواهر البلاغة في المعاني والبيان والبديع","أعلام السيرة النبوية في القرن الثاني للهجرة","شرح سنن النسائي - الراجحي","فتاوى واستشارات الإسلام اليوم","مذكرة أصول الفقه - الجامعة الإسلامية","الوفيات والأحداث","صحيح كنوز السنة النبوية","التفسير الميسر","فتح السلام شرح عمدة الأحكام من فتح الباري","المنتخب في ذكر نسب قبائل العرب","المنهاج الواضح للبلاغة","البيان والتعريف في أسباب ورود الحديث الشريف","متون طالب العلم - المستوى الخامس - 3","تفسير أسماء الله الحسنى للسعدي","شرح رياض الصالحين لابن عثيمين","يسألونك عن رمضان","تكملة المعاجم العربية","التفسير الوسيط - الزحيلي","التفسير القيم = تفسير القرآن الكريم لابن القيم","قاموس الإملاء","علوم البلاغة","السيرة النبوية لأبي الحسن الندوي","مدارج السالكين - ط عطاءات العلم","نونية ابن القيم الكافية الشافية - ط عطاءات العلم","المختصر في تفسير القرآن الكريم","نيل الأوطار شرح منتقى الأخبار - ط الحديث","التنوير شرح الجامع الصغير","قواعد التجويد على رواية حفص عن عاصم بن أبي النجود","شرح صحيح البخاري - عبد الكريم الخضير","منهج الإمام أحمد في إعلال الأحاديث","السيرة النبوية كما جاءت في الأحاديث الصحيحة","تقريب فتاوى ابن تيمية","ترجمة القرآن الكريم","تفسير العثيمين: الحجرات - الحديد","تحرير تقريب التهذيب","المعتصر من شرح مختصر الأصول من علم الأصول","علوم البلاغة «البديع والبيان والمعاني»","الفقه المنهجي على مذهب الإمام الشافعي","الإعراب المفصل لكتاب الله المرتل","المختصر في المنطق","مفهوم التفسير والتأويل والاستنباط والتدبر والمفسر","الجرح والتعديل - اللاحم","فتاوى مهمة تتعلق بالحج والعمرة","الرسائل الحربية في عصر الدولة الأيوبية","حاشية ابن عابدين = رد المحتار ط الحلبي","عشائر العراق","مدخل إلى التفسير وعلوم القرآن","الإمام البخاري وكتابه الجامع الصحيح","فائدة جليلة في قواعد الأسماء الحسنى","التفسير الواضح","المعجم الوسيط","التسهيل في فقه الإمام أحمد - وزارة الأوقاف الكويتية","أيسر التفاسير للجزائري","أصول النحو 2 - جامعة المدينة","بغية المقتصد شرح بداية المجتهد","موجز التاريخ الإسلامي من عهد آدم إلى عصرنا الحاضر","السيرة النبوية الصحيحة محاولة لتطبيق قواعد المحدثين في نقد روايات السيرة النبوية","نضرة النعيم في مكارم أخلاق الرسول الكريم","قواعد الإملاء","الرحيق المختوم","البر والصلة لابن الجوزي","مقاصد الشريعة الإسلامية","دراسات في تاريخ العرب القديم","إتحاف الأريب بشرح الغاية والتقريب","سبل السلام شرح بلوغ المرام - ط الحديث","اللؤلؤ المكنون في سيرة النبي المأمون","نظرية المقاصد عند الإمام الشاطبي","سير أعلام النبلاء - ط الرسالة","القاموس المحيط","البدع والمخالفات في الحج","أساليب بلاغية","غاية المرام في تخريج أحاديث الحلال والحرام","الروح - ابن القيم - ط عطاءات العلم","هداية الحيارى في أجوبة اليهود والنصارى - ط عطاءات العلم","موسوعة المفاهيم الإسلامية العامة","شرح الأربعين النووية - العباد","تفسير العثيمين: النساء","أصول الإيمان لمحمد بن عبد الوهاب - ت الجوابرة","عون المعبود وحاشية ابن القيم","تيسير اللطيف المنان في خلاصة تفسير القرآن - ط الأوقاف السعودية","شرح عمدة الأحكام - عبد الكريم الخضير","الوجيز في إيضاح قواعد الفقة الكلية","حاشية السندي على سنن ابن ماجه","تفسير العثيمين: النمل","السيرة النبوية والدعوة في العهد المكي","بغية الإيضاح لتلخيص المفتاح في علوم البلاغة","قصة الحضارة","فيض الباري على صحيح البخاري","مناظرة بين الإسلام والنصرانية","النظم البلاغي بين النظرية والتطبيق","بحوث في تاريخ السنة المشرفة","الوجيز في حكم تجويد الكتاب العزيز","التخريج عند الفقهاء والأصوليين","تفسير العثيمين: الشعراء","الأسلوب","المسند الجامع","حاشية الصاوي على الشرح الصغير = بلغة السالك لأقرب المسالك","تلخيص فقة الفرائض","فقه السيرة للغزالي","فقه المعاملات","مختصر في قواعد التفسير","سلسلة الآداب - المنجد","الدرر البهية من الفتاوى الكويتية","شرح الأربعين النووية للعثيمين","التحرير والتنوير","فتح القدير للشوكاني","العقود الدرية في تنقيح الفتاوى الحامدية","سلسلة الأحاديث الصحيحة وشيء من فقهها وفوائدها","تفسير القرطبي = الجامع لأحكام القرآن","فقه العبادات على المذهب الشافعي","التحفة الندية شرح العقيدة الواسطية - عبد الرحمن العقل","سلسلة الفوائد الحديثية والفقهية","شرح المحرر في الحديث - عبد الكريم الخضير","معجم تصحيح لغة الإعلام العربي","آداب البحث والمناظرة","شرح سنن الترمذي - عبد الكريم الخضير","المجتبى من مشكل إعراب القرآن","المختصر المفيد في أحكام التجويد - بآخر مصحف القراءات والتجويد","مواهب الجليل من أدلة خليل","التذهيب في أدلة متن الغاية والتقريب","السيرة النبوية - راغب السرجاني","معالم مكة التأريخية والأثرية","تفسير العثيمين: الأنعام","حياة محمد صلى الله عليه وآله وسلم","متون طالب العلم - الإضافية - 2","التجريد لبغية المريد في القراءات السبع - ت ضاري","الأحاديث الواردة في فضائل الصحابة","لطائف قرآنية","المتشابه","تفسير البيضاوي = أنوار التنزيل وأسرار التأويل","خصائص التراكيب دارسة تحليلية لمسائل علم المعاني","تفسير العثيمين: فصلت","فقه النوازل في العبادات","الوابل الصيب - ط دار الحديث","السيرة النبوية بين الآثار المروية والآيات القرآنية","فتاوى دار الإفتاء المصرية","زوائد الأحاديث الواردة في فضائل الصحابة","شرح المدائح النبوية","جامع تفاسير الأحلام = تنبيه الأفهام بتأويل الأحلام","الطبقات للنسائي","أصول الإيمان لابن باز","صحيح السيرة النبوية للألباني","تفسير العثيمين: لقمان","شرح جامع الترمذي - الراجحي","مدونة أحكام الوقف الفقهية","معجم المعالم الجغرافية في السيرة النبوية","الأديان والمذاهب - جامعة المدينة","الفتح المبين بشرح الأربعين","تحفة المودود بأحكام المولود - ط عطاءات العلم","لا تحزن","موسوعة الفرق المنتسبة للإسلام","مائة من عظماء أمة الإسلام غيروا مجرى التاريخ","منهج الإمام الطاهر بن عاشور في التفسير","حاشية السيوطي على سنن النسائي","السيرة النبوية منهجية دراستها واستعراض أحداثها","تفسير العثيمين: القصص","تفسير العثيمين: النور","تذكرة الأريب في تفسير الغريب","أثر العقيدة الإسلامية في تضامن ووحدة الأمة الإسلامية","السياسة الشرعية - جامعة المدينة","فتاوى إسلامية","فقه السيرة النبوية مع موجز لتاريخ الخلافة الراشدة","معجم الشعراء العرب","القواعد الفقهية وتطبيقاتها في المذاهب الأربعة","منهاج أهل السنة والجماعة في العقيدة والعمل","الجنايات في الفقه الإسلامي دراسة مقارنة بين الفقه الإسلامي والقانون","تسهيل الفرائض","تفسير العثيمين: الفاتحة والبقرة","شرح كتاب الإيمان - يوسف الغفيص","صيد الخاطر","المنيحة بسلسلة الأحاديث الصحيحة","شرح صحيح البخاري - أسامة سليمان","تلخيص الأصول","الشامل في زكاة الأسهم واستثمار أموال الزكاة","حاشية السندي على سنن الترمذي","موسوعة أحكام الطهارة - الدبيان - ط 3","الموسوعة القرآنية","المدخل في تاريخ السنة","تطور كتابة المصحف الشريف وطباعته","الأشباه والنظائر - ابن نجيم","معجم قبائل المملكة العربية السعودية","الدر المنثور في التفسير بالمأثور","طبائع الاستبداد ومصارع الاستعباد","الفوائد لابن القيم - ط عطاءات العلم","موسوعة الأخلاق الإسلامية","المدخل إلي جامع الترمذي","العلاج والرقى","تاريخ القرآن الكريم","فتاوى الشبكة الإسلامية","دولة الإسلام في الأندلس","فتح الباري بشرح البخاري - ط السلفية","شرح سنن أبي داود للعباد","من شرح بلوغ المرام للطريفي","التفسير الموضوعي 2 - جامعة المدينة","المفصل فى تاريخ العرب قبل الإسلام","الإعلام بأحكام المال الحرام","إعانة الطالب في بداية علم الفرائض","أسواق العرب في الجاهلية والإسلام","منة المنعم في شرح صحيح مسلم","شرح الأجرومية للأسمري","يسألونك عن الزكاة","شرح صحيح ابن خزيمة - الراجحي","الآداب الإسلامية","الأندلس من الفتح إلى السقوط","تهذيب التهذيب - ط دبي","شرح بلوغ المرام - اللهيميد","العذب النمير من مجالس الشنقيطي في التفسير","كيف تربي ولدك","القطارة النحوية على المقدمة الآجرومية","درر الحكام في شرح مجلة الأحكام","مجموعة الوثائق السياسية للعهد النبوي والخلافة الراشدة","الأحكام الشرعية المتعلقة بالوباء والطاعون مع دراسة فقهية للأحكام المتعلقة بفيروس كورونا","مقالات موقع الدرر السنية","التفسير الوسيط - مجمع البحوث","تاريخ العرب وحضارتهم في الأندلس","متون طالب العلم - المستوى التمهيدي","الشفعة بين الجمع العثماني والأحرف السبعة","الشورى في الشريعة الإسلامية","تحفة الأريب بما في القرآن من الغريب","التعريف بالقرآن الكريم","موسوعة الملل والأديان","شرح الآجرومية - حسن حفظي","الميسر في القراءات الأربع عشرة","آيات متشابهات الألفاظ في القرآن الكريم وكيف التمييز بينها","موجز دائرة المعارف الإسلامية","التعريف بالإسلام","معجم الصواب اللغوي","مختصر تفسير البغوي المسمى بمعالم التنزيل","تفسير العثيمين: من جزء قد سمع وتبارك - ط مكتبة الطبري","شرح تفسير ابن كثير - الراجحي","الداء والدواء = الجواب الكافي - ط دار المعرفة","الفتاوى الاقتصادية","القواعد الأصولية والفقهية المتعلقة بالمسلم غير المجتهد","فقه الأسرة","ورد اليوم والليلة","معجم الدخيل في اللغة العربية الحديثة ولهجاتها","الدرة السنية منظومة في علم الفرائض","المال والحكم في الإسلام","صحيح الكتب التسعة وزوائده","تفسير العثيمين: الأحزاب","فتح الكريم المنان في آداب حملة القرآن","موسوعة الإعجاز العلمي في القرآن والسنة","تيسير أحكام التجويد - المستوى الأول","زاد المسير في علم التفسير","سبيل المهتدين إلى شرح الأربعين النووية","صحيح السيرة النبوية للعلي","المعالم الأثيرة في السنة والسيرة","تفسير العثيمين: فاطر","مرويات السيرة لأكرم العمري","عدة الصابرين وذخيرة الشاكرين - ط عطاءات العلم","المعاجم المفهرسة لألفاظ القرآن الكريم","شرح صحيح البخاري للحويني","تفسير العثيمين: الشورى","مناسبات الآيات والسور","تفسير العثيمين: العنكبوت","تفسير العثيمين: الزخرف","دراسات في أصول اللغات العربية","تاريخ العرب القديم","معجزات القرآن العلمية","شرح المعتمد في أصول الفقه","الوجيز في علم التجويد","مسائل مهمات تتعلق بفقه الصوم والتراويح والقراءة على الأموات","الأزهر وأثره في النهضة الأدبية الحديثة","تفسير أسماء الله الحسنى للزجاج","تراجم منتخبة من «التهذيب» و «الميزان» - ضمن «آثار المعلمي»","لسان العرب","قواعد الفقه","الهادي شرح طيبة النشر في القراءات العشر","خاتم النبيين صلى الله عليه وآله وسلم","البلاغة 2 - المعاني - جامعة المدينة","صفوة التفاسير","رسائل وفتاوى عبد العزيز آل الشيخ","موسوعة القواعد الفقهية","غريب الحديث - ابن الجوزي","الإمام مسلم وصحيحه","الكوكب الدري على جامع الترمذي","معجم وتفسير لغوى لكلمات القرآن","دراسات في فقه اللغة","الفقه الميسر في ضوء الكتاب والسنة","فقه العبادات على المذهب الحنفي","تيسير العلام شرح عمدة الأحكام","المنتخب في تفسير القرآن الكريم","المدخل إلى دراسة المدارس والمذاهب الفقهية","الموسوعة العقدية","أثر اختلاف الأسانيد والمتون في اختلاف الفقهاء","الروضة الندية شرح متن الجزرية","الطبقات السنية في تراجم الحنفية","اللغة وعلم اللغة","المسائل الفقهية التي عليها الفتوى عند متأخري الحنفية - جمعا ودراسة-","أصول الفقه الذي لا يسع الفقيه جهله","التذييل على تهذيب التهذيب","الرسول القائد","العقد الثمين في شرح منظومة الشيخ ابن عثيمين","متون طالب العلم - المستوى الثاني","موسوعة المذاهب الفكرية المعاصرة","الخلافة","إعلام الموقعين عن رب العالمين - ط العلمية","الخلاصة الفقهية على مذهب السادة المالكية","الإسلام وأوضاعنا القانونية","تفسير العثيمين: سبأ","تفسير العثيمين: المائدة","الأديان الوضعية - جامعة المدينة","فتح العلام في دراسة أحاديث بلوغ المرام ط 4","القواعد والضوابط الفقهية المتضمنة للتيسير","معجم الجرح والتعديل لرجال السنن الكبرى","شرح مسند أبي حنيفة","البحر المحيط الثجاج في شرح صحيح الإمام مسلم بن الحجاج","شرح سنن النسائي المسمى شروق أنوار المنن الكبرى الإلهية بكشف أسرار السنن الصغرى النسائية","التوجيه والإرشاد النفسي","فقه العبادات على المذهب المالكي","الفتاوى الكبرى لابن تيمية","متون طالب العلم - الإضافية - 1","جمع القرآن الكريم في عهد الخلفاء الراشدين - عبد القيوم السندي","محاضرات في علوم الحديث","علم الجرح والتعديل","موسوعة تفسير الأحلام","لمسات بيانية في نصوص من التنزيل - كتاب","شرح المقدمة الحضرمية المسمى بشرى الكريم بشرح مسائل التعليم","شرح القواعد الفقهية","تفسير العثيمين: يس","الرقية الشرعية","مدرسة الحديث في مصر","شرح الأربعين النووية - عبد الكريم الخضير","شرح العقيدة الواسطية - الغنيمان","التفسير القرآني للقرآن","القاموس الفقهي","المغني لابن قدامة - ت التركي","تفسير ابن رجب الحنبلي","صفة الصفوة","متون طالب العلم - المستوى الخامس - 2","موسوعة مرآة الحرمين الشريفين وجزيرة العرب","فتاوى اللجنة الدائمة - المجموعة الأولى","جوامع الدعاء","تاريخ نزول القرآن","تاريخ شبه الجزيرة العربية في عصورها القديمة","حياة الصحابة","مدخل في علوم القراءات","بينات الرسول صلى الله عليه وآله وسلم ومعجزاته","موسوعة التفسير المأثور","نحو معجم تاريخي للمصطلحات القرآنية المعرفة","توفيق الرب المنعم بشرح صحيح الإمام مسلم","مجموعة رسائل وفتاوى في مسائل مهمة تمس إليها حاجة العصر","شرح مسند الدارمي","تفسير العثيمين: جزء عم","الإيمان حقيقته، خوارمه، نواقضه عند أهل السنة والجماعة","اللغة العربية معناها ومبناها","تفسير العثيمين: غافر","السرايا والبعوث النبوية حول المدينة ومكة","جمهرة الأجزاء الحديثية","الإسلام وأوضاعنا السياسية","القرآن وإعجازه العلمي","متون طالب العلم - الإضافية - 4","الكواشف الجلية في حكم قراءة القرآن بالمقامات الموسيقية","معالم أصول الفقه عند أهل السنة والجماعة","صفحات في علوم القراءات","المدخل إلى صحيح البخاري","المجالس الفقهية","زاد المعاد في هدي خير العباد - ط عطاءات العلم","الموسوعة التاريخية","شرح سنن أبي داود - الراجحي","البديع عند الحريري","تقريب التهذيب","صحيح الأثر وجميل العبر من سيرة خير البشر (صلى الله عليه وسلم)","فقه الدعوة الإسلامية في الغرب ووجوب تجديدها على الحكمة والوسطية والاعتدال","متون طالب العلم - الإضافية - 10","اللباب في قواعد اللغة وآلات الأدب النحو والصرف والبلاغة والعروض واللغة والمثل","شذرات الذهب دراسة في البلاغة القرآنية","علم اللغة مقدمة للقارئ العربي","شرح التدمرية - محمد بن خليفة التميمي","المنهج الحركي للسيرة النبوية","شرح عمدة الأحكام لابن جبرين","السيرة النبوية - دروس وعبر","شرح مقدمة في أصول التفسير لابن تيمية","الجامع لكتب الضعفاء والمتروكين والكذابين","شرح كتاب الفتن من صحيح البخاري - عبد الكريم الخضير","تفسير ابن كثير - ط ابن الجوزي","تفسير القرآن الكريم - المقدم","البلاغة 1 - البيان والبديع - جامعة المدينة","شرح مائة المعاني والبيان","الخلاصة البهية في ترتيب أحداث السيرة النبوية","الدرر الثرية من الفتاوى البازية","فتح الودود في شرح سنن أبي داود","علم البديع","طريق الهجرتين وباب السعادتين - ط عطاءات العلم","المنهل العذب المورود شرح سنن أبي داود","الموسوعة القرآنية المتخصصة","متون طالب العلم - الإضافية - 8","بحوث ومقالات في اللغة","إغاثة اللهفان في مصايد الشيطان - ت الفقي","منتقى الأذكار","الفقه الميسر","سلسلة القصص - المنجد","الصحاح تاج اللغة وصحاح العربية","إكمال تهذيب الكمال - ط العلمية","البدهيات في القرآن الكريم","القيم الإسلامية","المسلمون في بلاد الغربة","موسوعة سفير للتاريخ الإسلامي","مهمات في أحكام المواريث","الفتاوى اليومية من المسائل الفقهية","تفسير العثيمين: الروم","كيف تحفظ القرآن الكريم","مقدمات في علم القراءات","فتح المنعم شرح صحيح مسلم","الإتقان في ضوابط تسجيل القرآن","نزول القران الكريم وتاريخه وما يتعلق به","شرح الموطأ - عبد الكريم الخضير","موجز عن الفتوحات الإسلامية","الاستقصا لأخبار دول المغرب الأقصى","الرسالة الندية في القواعد الفقهية","فقه الهندسة المالية الإسلامية","التربية الإسلامية أصولها ومنهجها ومعلمها","موسوعة القبائل العربية","تفسير السعدي = تيسير الكريم الرحمن","شرح سنن ابن ماجه للهرري = مرشد ذوي الحجا والحاجة إلى سنن ابن ماجه","متون طالب العلم - الإضافية - 3","المدخل إلى دراسة المذاهب الفقهية","التفسير الموضوعي للقرآن الكريم ونماذج منه","معجم قبائل العرب القديمة والحديثة","محمد صلى الله عليه وسلم","فقه الأدعية والأذكار","يسألونك عن المعاملات المالية المعاصرة","شرح العقيدة الأصفهانية","الطبقات الكبرى - ط الخانجي","الفقه والشريعة","شرح سنن ابن ماجة - الراجحي","الجامع في أمثال القرآن","سبل السلام من صحيح سيرة خير الأنام عليه الصلاة والسلام","موسوعة صناعة الحلال","تفسير غريب ما في الصحيحين البخاري ومسلم","تفسير العثيمين: الفرقان","شرح الترغيب والترهيب للمنذرى - حطيبة","خطب مختارة","روضة المحبين ونزهة المشتاقين - ط عطاءات العلم","الحديث الموضوعي المنهج والتأصيل والتمثيل","مدخل إلى علوم الشريعة","الإسلام والحكم","تفسير العثيمين: ص","المعجم الجامع في تراجم المعاصرين","البلاغة العربية","متون طالب العلم - المستوى الأول","الأخلاق في الإسلام","الموسوعة الفقهية","البحر المديد في تفسير القرآن المجيد","علم البيان","التشريع الجنائي الإسلامي مقارنا بالقانون الوضعي","تفسير العثيمين: آل عمران","الأساس في السنة وفقهها - السيرة النبوية","التوضيح والبيان لشجرة الإيمان","معرفة القراء الكبار على الطبقات والأعصار","تفسير البغوي - طيبة","فتح القوي المتين في شرح الأربعين وتتمة الخمسين للنووي وابن رجب رحمهما الله","علم الفرائض والمواريث في الشريعة الإسلامية والقانون السوري","نزول القرآن الكريم والعناية به في عهد الرسول صلى الله عليه وسلم","بذل المجهود في حل سنن أبي داود","مناهج البحث في العلوم السياسية","فتاوى الطب والمرضى","متون طالب العلم - الإضافية - 5","تفسير الشعراوي","برنامجك في رمضان","شرح بلوغ المرام - عبد الكريم الخضير","علم المعاني","المنتخب من وصايا الآباء للأبناء","مختصر سيرة الرسول صلى الله عليه وسلم لمحمد بن عبد الوهاب","آل الجرباء في التاريخ والأدب","البلاغة الصافية في المعاني والبيان والبديع","شرح رسالة لطيفة جامعة في أصول الفقه المهمة","تفسير العثيمين: الصافات","التعريفات الفقهية","متون طالب العلم - الإضافية - 6","شرح العقيدة السفارينية","تاريخ الدولة العلية العثمانية","الجامع الصحيح للسيرة النبوية","إسعاف الأعيان في أنساب أهل عمان","أسرار البيان في التعبير القرآني - كتاب","النظام القضائي في الفقه الإسلامي","علم اللغة","الفتاوى العالمكيرية = الفتاوى الهندية","روح البيان","اصطلاح المذهب عند المالكية","التفسير الوسيط لطنطاوي","مجموعة الرسائل والمسائل النجدية (الجزء الرابع، القسم الثاني)","فقه عمل اليوم والليلة","أصول الإيمان في ضوء الكتاب والسنة","الإيمان لابن تيمية","شرح العقيدة الطحاوية - عبد العزيز الراجحي","تفسير العثيمين: الكهف","أصول النحو 1 - جامعة المدينة","وجوب تطبيق الشريعة الإسلامية في كل عصر","الموسوعة الفقهية الكويتية","موسوعة الإجماع في الفقه الإسلامي - ط الفضيلة","صحيح سنن أبي داود ط غراس","إعراب القرآن الكريم - ط دار الصحابة","التفسير النبوي","شرح العقيدة الواسطية - العثيمين","المغني في ضبط الأسماء لرواة الأنباء","كتاب سيرة النبي صلى الله عليه وسلم","نور اليقين في سيرة سيد المرسلين","لمحات مهمة في الوصية","مختصر زاد المعاد","العقيدة الصحيحة وما يضادها ونواقض الإسلام","المعاجم العربية مع اعتناء خاص بمعجم العين للخليل بن أحمد","مقتطفات من السيرة","معجم اللغة العربية المعاصرة","مدخل إلى تفسير القرآن وعلومه","فقه النكاح والفرائض","الحافظ العراقي وكتابه تكملة شرح الترمذي - مجلة الهند","شرح العقيدة الطحاوية - صالح آل الشيخ = إتحاف السائل بما في الطحاوية من مسائل","تفسير الألوسي = روح المعاني","سلسلة الآثار الصحيحة أو الصحيح المسند من أقوال الصحابة والتابعين","حاشية السندي على سنن النسائي","معجم لغة الفقهاء","متون طالب العلم - المستوى الخامس - 1","مختصر تفسير ابن كثير","أوضح التفاسير","شرح صحيح ابن حبان - الراجحي","التحفة المكية في توضيح أهم القواعد الفقهية","تاريخ الخلفاء الراشدين الفتوحات والإنجازات السياسية","شرح متن أبي شجاع - محمد حسن عبد الغفار","تفسير العثيمين: من سورة محمد - ط مكتبة الطبري","تجريد القواعد والفوائد الأصولية","شمائل الرسول صلى الله عليه وآله وسلم","المنهج التأصيلي لدراسة التفسير التحليلي","شرح مقدمة سنن ابن ماجه","نظام الإثبات في الفقه الإسلامي","الرسالة التبوكية زاد المهاجر إلى ربه - ت غازي","شرح كتاب الإيمان الأوسط لابن تيمية - الراجحي","موسوعة الأعلام - الأوقاف المصرية","الكوكب الوهاج شرح صحيح مسلم بن الحجاج","صحيح سنن النسائي","شرح اختصار علوم الحديث - اللاحم","مختار الصحاح","أضواء البيان في إيضاح القرآن بالقرآن - ط عطاءات العلم","مجلة الأحكام العدلية","أسرار المحبين في رمضان","السياسة الشرعية في الشئون الدستورية والخارجية والمالية","نزول القرآن على سبعة أحرف","دليل الحاج والمعتمر وزائر مسجد الرسول صلى الله عليه وسلم","فتاوى عاجلة لمنسوبي الصحة","المغالطات المنطقية","فقه السنة","من قضايا البلاغة والنقد عند عبد القادر الجرجاني","مجموعة الرسائل والمسائل النجدية (الجزء الأول)","متون طالب العلم - المستوى الثالث","متون طالب العلم - المستوى الرابع","تفسير القرآن الكريم وإعرابه وبيانه - الدرة","فتاوى اللجنة الدائمة - المجموعة الثانية","الموسوعة الميسرة في الأديان والمذاهب والأحزاب المعاصرة","التحالف السياسي في الإسلام"],"title":"BookNamesEnum"},"CancelSource":{"type":"string","enum":["owner","admin"],"title":"CancelSource"},"ChatCompletionAssistantMessageParam":{"properties":{"role":{"type":"string","const":"assistant","title":"Role"},"content":{"anyOf":[{"type":"string"},{"items":{"anyOf":[{"$ref":"#/components/schemas/ChatCompletionContentPartTextParam"},{"$ref":"#/components/schemas/ChatCompletionContentPartRefusalParam"}]},"type":"array"},{"type":"null"}],"title":"Content"},"name":{"type":"string","title":"Name"},"tool_calls":{"anyOf":[{"items":{"$ref":"#/components/schemas/ChatCompletionToolCall"},"type":"array"},{"type":"null"}],"title":"Tool Calls"}},"type":"object","required":["role"],"title":"ChatCompletionAssistantMessageParam"},"ChatCompletionChoice-Input":{"properties":{"finish_reason":{"type":"string","enum":["stop","length","tool_calls","content_filter","function_call"],"title":"Finish Reason"},"index":{"type":"integer","title":"Index"},"logprobs":{"anyOf":[{"$ref":"#/components/schemas/ChoiceLogprobs-Input"},{"type":"null"}]},"message":{"$ref":"#/components/schemas/ChatCompletionChoiceMessage-Input"}},"additionalProperties":true,"type":"object","required":["finish_reason","index","message"],"title":"ChatCompletionChoice"},"ChatCompletionChoice-Output":{"properties":{"finish_reason":{"type":"string","enum":["stop","length","tool_calls","content_filter","function_call"],"title":"Finish Reason"},"index":{"type":"integer","title":"Index"},"logprobs":{"anyOf":[{"$ref":"#/components/schemas/ChoiceLogprobs-Output"},{"type":"null"}]},"message":{"$ref":"#/components/schemas/ChatCompletionChoiceMessage-Output"}},"additionalProperties":true,"type":"object","required":["finish_reason","index","message"],"title":"ChatCompletionChoice"},"ChatCompletionChoiceMessage-Input":{"properties":{"content":{"anyOf":[{"type":"string"},{"items":{"anyOf":[{"$ref":"#/components/schemas/ChatCompletionContentText"},{"$ref":"#/components/schemas/ChatCompletionContentImage"},{"$ref":"#/components/schemas/ChatCompletionContentAudio"}]},"type":"array"},{"type":"null"}],"title":"Content"},"role":{"type":"string","const":"assistant","title":"Role"},"references":{"anyOf":[{"items":{"$ref":"#/components/schemas/ChatCompletionChoiceMessageReference"},"type":"array"},{"type":"null"}],"title":"references","description":"The list of references used in the response"},"tool_calls":{"anyOf":[{"items":{"$ref":"#/components/schemas/ChatCompletionToolCall"},"type":"array"},{"type":"null"}],"title":"tool_calls","description":"The list of tool calls made by the assistant."}},"type":"object","required":["role"],"title":"ChatCompletionChoiceMessage"},"ChatCompletionChoiceMessage-Output":{"properties":{"content":{"anyOf":[{"type":"string"},{"items":{"anyOf":[{"$ref":"#/components/schemas/ChatCompletionContentText"},{"$ref":"#/components/schemas/ChatCompletionContentImage"},{"$ref":"#/components/schemas/ChatCompletionContentAudio"}]},"type":"array"},{"type":"null"}],"title":"Content"},"role":{"type":"string","const":"assistant","title":"Role"},"references":{"anyOf":[{"items":{"$ref":"#/components/schemas/ChatCompletionChoiceMessageReference"},"type":"array"},{"type":"null"}],"title":"references","description":"The list of references used in the response"},"tool_calls":{"anyOf":[{"items":{"$ref":"#/components/schemas/ChatCompletionToolCall"},"type":"array"},{"type":"null"}],"title":"tool_calls","description":"The list of tool calls made by the assistant."}},"type":"object","required":["role"],"title":"ChatCompletionChoiceMessage"},"ChatCompletionChoiceMessageReference":{"properties":{"index":{"description":"The location of the reference in the response","title":"index","type":"integer"},"number":{"description":"The reference number in the response","title":"number","type":"integer"},"source":{"description":"The source of the reference","title":"source","type":"string"},"content":{"description":"The content of the reference","title":"content","type":"string"}},"required":["index","number","source","content"],"title":"ChatCompletionChoiceMessageReference","type":"object"},"ChatCompletionContentAudio":{"properties":{"type":{"type":"string","const":"audio_url","title":"Type"},"audio_url":{"$ref":"#/components/schemas/URL"}},"type":"object","required":["type","audio_url"],"title":"ChatCompletionContentAudio"},"ChatCompletionContentImage":{"properties":{"type":{"type":"string","const":"image_url","title":"Type"},"image_url":{"$ref":"#/components/schemas/URL"}},"type":"object","required":["type","image_url"],"title":"ChatCompletionContentImage"},"ChatCompletionContentPartImageParam":{"properties":{"image_url":{"$ref":"#/components/schemas/ImageURL"},"type":{"type":"string","const":"image_url","title":"Type"}},"type":"object","required":["image_url","type"],"title":"ChatCompletionContentPartImageParam"},"ChatCompletionContentPartRefusalParam":{"properties":{"refusal":{"type":"string","title":"Refusal"},"type":{"type":"string","const":"refusal","title":"Type"}},"type":"object","required":["refusal","type"],"title":"ChatCompletionContentPartRefusalParam"},"ChatCompletionContentPartTextParam":{"properties":{"text":{"type":"string","title":"Text"},"type":{"type":"string","const":"text","title":"Type"}},"type":"object","required":["text","type"],"title":"ChatCompletionContentPartTextParam"},"ChatCompletionContentPartVideoParam":{"properties":{"video_url":{"$ref":"#/components/schemas/VideoURL"},"type":{"type":"string","const":"video_url","title":"Type"}},"type":"object","required":["video_url","type"],"title":"ChatCompletionContentPartVideoParam"},"ChatCompletionContentText":{"properties":{"type":{"type":"string","const":"text","title":"Type"},"text":{"type":"string","title":"Text"}},"type":"object","required":["type","text"],"title":"ChatCompletionContentText"},"ChatCompletionLLM":{"type":"string","enum":["Fanar","Fanar-S-1-7B","Fanar-C-1-8.7B","Fanar-C-2-27B","Fanar-Sadiq","Fanar-Sadiq-2","Fanar-Oryx-IVU-2"],"title":"ChatCompletionLLM"},"ChatCompletionRequest":{"properties":{"messages":{"items":{"anyOf":[{"$ref":"#/components/schemas/ChatCompletionSystemMessageParam"},{"$ref":"#/components/schemas/ChatCompletionUserMessageParam"},{"$ref":"#/components/schemas/ChatCompletionAssistantMessageParam"},{"$ref":"#/components/schemas/ChatCompletionThinkingUserMessageParam"},{"$ref":"#/components/schemas/ChatCompletionThinkingMessageParam"}]},"type":"array","title":"Messages"},"model":{"$ref":"#/components/schemas/ChatCompletionLLM","description":"The model to use for the completion. For the Fanar-Sadiq and Fanar-Sadiq-2 models, the following LLM parameters are not used."},"enable_thinking":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enable Thinking","description":"Whether to enable the thinking role in the conversation. This only applies if the model supports it. Currently, only the Fanar-C-2-27B model supports this parameter with additional authorization.","default":false},"frequency_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Frequency Penalty","description":"A penalty for how much new tokens should avoid repeating existing ones.","default":0.0},"logit_bias":{"anyOf":[{"additionalProperties":{"type":"number"},"type":"object"},{"type":"null"}],"title":"Logit Bias","description":"Modify the likelihood of specified tokens appearing in the completion."},"logprobs":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Logprobs","description":"Whether to return log probabilities of the output tokens or not."},"top_logprobs":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Top Logprobs","description":"An integer between 0 and 20 specifying the number of most likely tokens toreturn at each token position, each with an associated log probability."},"max_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Tokens","description":"The maximum number of tokens that can be generated in the chat completion."},"n":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"N","description":"How many chat completion choices to generate for each input message."},"presence_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Presence Penalty","description":"Number between -2.0 and 2.0. Positive values penalize new tokens based onwhether they appear in the text so far, increasing the model's likelihood totalk about new topics."},"stop":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Stop","description":"Up to 4 sequences where the API will stop generating further tokens."},"stream":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Stream","description":"Whether to stream back partial progress as tokens are generated.","default":false},"temperature":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Temperature","description":"The sampling temperature, where 0.0 means deterministic output.","default":0.0},"top_p":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Top P","description":"Controls the cumulative probability of the top tokens to consider."},"best_of":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Best Of","description":"Number of output sequences that are generated from the prompt."},"top_k":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Top K","description":"Controls the number of top tokens to consider."},"min_p":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Min P","description":"Represents the minimum probability for a token to be considered, relative to the probability of the most likely token."},"repetition_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Repetition Penalty","description":"A penalty for repeating the same tokens in the generated output.","default":1.1},"length_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Length Penalty","description":"Penalizes sequences based on their length. Used in beam search."},"early_stopping":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Early Stopping","description":"Controls the stopping condition for beam-based methods."},"stop_token_ids":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"title":"Stop Token Ids","description":"List of tokens that stop the generation when they are generated."},"ignore_eos":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ignore Eos","description":"Whether to ignore the EOS token and continue generating tokens after the EOS token is generated."},"min_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Min Tokens","description":"Minimum number of tokens to generate per output sequence before EOS or stop_token_ids can be generated."},"skip_special_tokens":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Skip Special Tokens","description":"Whether to skip special tokens in the output."},"spaces_between_special_tokens":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Spaces Between Special Tokens","description":"Whether to add spaces between special tokens in the output."},"truncate_prompt_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Truncate Prompt Tokens","description":"If set to an integer k, will use only the last k tokens from the prompt"},"prompt_logprobs":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Prompt Logprobs","description":"Number of log probabilities to return per prompt token."},"book_names":{"anyOf":[{"items":{"$ref":"#/components/schemas/BookNamesEnum"},"type":"array"},{"type":"null"}],"title":"Book Names","description":"List of book names to use for the Fanar-Sadiq model."},"preferred_sources":{"anyOf":[{"items":{"anyOf":[{"$ref":"#/components/schemas/SourcesEnum"},{"type":"string"}]},"type":"array"},{"type":"null"}],"title":"Preferred Sources","description":"List the preferred sources to use for the Fanar-Sadiq model, in order of priority, with fallback sources used if needed. Accepts predefined source names or values starting with 'digital_seerah'."},"exclude_sources":{"anyOf":[{"items":{"anyOf":[{"$ref":"#/components/schemas/SourcesEnum"},{"type":"string"}]},"type":"array"},{"type":"null"}],"title":"Exclude Sources","description":"List of sources to exclude from the Fanar-Sadiq model. Accepts predefined source names or values starting with 'digital_seerah'."},"filter_sources":{"anyOf":[{"items":{"anyOf":[{"$ref":"#/components/schemas/SourcesEnum"},{"type":"string"}]},"type":"array"},{"type":"null"}],"title":"Filter Sources","description":"List of sources to filter from the Fanar-Sadiq model. Accepts predefined source names or values starting with 'digital_seerah'."},"madhab":{"anyOf":[{"items":{"$ref":"#/components/schemas/MadhabEnum"},"type":"array"},{"type":"null"}],"title":"Madhab","description":"List of madhab (Islamic school of thought) to filter by for the Fanar-Sadiq-2 model."},"restrict_to_islamic":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Restrict To Islamic","description":"When enabled for Fanar-Sadiq model, only Islamic content prompts will be accepted. Non-Islamic content will be rejected.","default":false},"persona":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Persona","description":"Custom persona that controls the assistant's voice and identity for the Fanar-Sadiq model. Free-form text; only supported for Fanar-Sadiq."}},"type":"object","required":["messages","model"],"title":"ChatCompletionRequest","example":{"model":"Fanar","messages":[{"role":"user","content":"Hello"}]}},"ChatCompletionRequestVoiceLangaugePair":{"properties":{"voice":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice"},"language":{"type":"string","title":"Language"}},"type":"object","required":["language"],"title":"ChatCompletionRequestVoiceLangaugePair"},"ChatCompletionResponse":{"properties":{"id":{"type":"string","title":"Id","description":"A unique identifier for the chat completion"},"choices":{"items":{"$ref":"#/components/schemas/ChatCompletionChoice-Output"},"type":"array","title":"Choices","description":"A list of chat completion choices.Can be more than one if `n` is greater than 1."},"created":{"type":"integer","title":"Created","description":"The Unix timestamp (in seconds) of when the chat completion was created."},"model":{"type":"string","title":"Model","description":"The model used for the chat completion."},"object":{"type":"string","const":"chat.completion","title":"Object","description":"The object type","default":"chat.completion"},"usage":{"anyOf":[{"$ref":"#/components/schemas/CompletionUsage"},{"type":"null"}],"description":"Usage statistics for the completion request."},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Additional metadata associated with the completion."}},"type":"object","required":["id","choices","created","model"],"title":"ChatCompletionResponse"},"ChatCompletionSystemMessageParam":{"properties":{"content":{"anyOf":[{"type":"string"},{"items":{"$ref":"#/components/schemas/ChatCompletionContentPartTextParam"},"type":"array"}],"title":"Content"},"role":{"type":"string","const":"system","title":"Role"},"name":{"type":"string","title":"Name"}},"type":"object","required":["content","role"],"title":"ChatCompletionSystemMessageParam"},"ChatCompletionThinkingMessageParam":{"properties":{"role":{"type":"string","const":"thinking","title":"Role"},"content":{"type":"string","title":"Content"}},"type":"object","required":["role","content"],"title":"ChatCompletionThinkingMessageParam"},"ChatCompletionThinkingUserMessageParam":{"properties":{"role":{"type":"string","const":"thinking_user","title":"Role"},"content":{"type":"string","title":"Content"}},"type":"object","required":["role","content"],"title":"ChatCompletionThinkingUserMessageParam"},"ChatCompletionTokenLogprob":{"properties":{"token":{"type":"string","title":"Token"},"bytes":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"title":"Bytes"},"logprob":{"type":"number","title":"Logprob"},"top_logprobs":{"items":{"$ref":"#/components/schemas/TopLogprob"},"type":"array","title":"Top Logprobs"}},"additionalProperties":true,"type":"object","required":["token","logprob","top_logprobs"],"title":"ChatCompletionTokenLogprob"},"ChatCompletionToolCall":{"properties":{"id":{"type":"string","title":"id","description":"The unique identifier for the tool call"},"name":{"type":"string","title":"name","description":"The name of the tool called"},"arguments":{"additionalProperties":true,"type":"object","title":"arguments","description":"The arguments passed to the tool"},"result":{"anyOf":[{},{"type":"null"}],"title":"result","description":"The result returned by the tool"},"structured_content":{"anyOf":[{},{"type":"null"}],"title":"structured_content","description":"The structured content returned by the tool"},"is_error":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"is_error","description":"Indicates if there was an error during the tool call"}},"type":"object","required":["id","name","arguments"],"title":"ChatCompletionToolCall"},"ChatCompletionUserMessageParam":{"properties":{"content":{"anyOf":[{"type":"string"},{"items":{"anyOf":[{"$ref":"#/components/schemas/ChatCompletionContentPartTextParam"},{"$ref":"#/components/schemas/ChatCompletionContentPartImageParam"},{"$ref":"#/components/schemas/ChatCompletionContentPartVideoParam"}]},"type":"array"}],"title":"Content"},"role":{"type":"string","const":"user","title":"Role"},"name":{"type":"string","title":"Name"}},"type":"object","required":["content","role"],"title":"ChatCompletionUserMessageParam"},"ChoiceLogprobs-Input":{"properties":{"content":{"anyOf":[{"items":{"$ref":"#/components/schemas/ChatCompletionTokenLogprob"},"type":"array"},{"type":"null"}],"title":"Content"},"refusal":{"anyOf":[{"items":{"$ref":"#/components/schemas/ChatCompletionTokenLogprob"},"type":"array"},{"type":"null"}],"title":"Refusal"}},"additionalProperties":true,"type":"object","title":"ChoiceLogprobs"},"ChoiceLogprobs-Output":{"properties":{"content":{"anyOf":[{"items":{"$ref":"#/components/schemas/ChatCompletionTokenLogprob"},"type":"array"},{"type":"null"}],"title":"Content"},"refusal":{"anyOf":[{"items":{"$ref":"#/components/schemas/ChatCompletionTokenLogprob"},"type":"array"},{"type":"null"}],"title":"Refusal"}},"additionalProperties":true,"type":"object","title":"ChoiceLogprobs"},"CompletionTokensDetails":{"additionalProperties":true,"properties":{"accepted_prediction_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"title":"Accepted Prediction Tokens"},"audio_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"title":"Audio Tokens"},"reasoning_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"title":"Reasoning Tokens"},"rejected_prediction_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"title":"Rejected Prediction Tokens"}},"title":"CompletionTokensDetails","type":"object"},"CompletionUsage":{"additionalProperties":true,"properties":{"completion_tokens":{"title":"Completion Tokens","type":"integer"},"prompt_tokens":{"title":"Prompt Tokens","type":"integer"},"total_tokens":{"title":"Total Tokens","type":"integer"},"completion_tokens_details":{"anyOf":[{"$ref":"#/components/schemas/CompletionTokensDetails"},{"type":"null"}],"default":null},"prompt_tokens_details":{"anyOf":[{"$ref":"#/components/schemas/PromptTokensDetails"},{"type":"null"}],"default":null}},"required":["completion_tokens","prompt_tokens","total_tokens"],"title":"CompletionUsage","type":"object"},"DeepResearchDepth":{"type":"string","enum":["quick","standard","comprehensive"],"title":"DeepResearchDepth"},"DeepResearchJobRequest":{"properties":{"model":{"type":"string","const":"Fanar-Sadiq-2","title":"Model"},"input":{"type":"string","title":"Input"},"depth":{"$ref":"#/components/schemas/DeepResearchDepth","default":"standard"},"web_search":{"type":"boolean","title":"Web Search","default":false}},"type":"object","required":["model","input"],"title":"DeepResearchJobRequest","description":"What a deep-research job was asked to do: `Job.request` for this type."},"DeepResearchReport-Input":{"properties":{"topic":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Topic"},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"title_ar":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title Ar"},"overview":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Overview"},"sections":{"anyOf":[{"items":{"$ref":"#/components/schemas/DeepResearchSection-Input"},"type":"array"},{"type":"null"}],"title":"Sections"},"sources":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Sources"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"},"markdown":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Markdown"}},"additionalProperties":true,"type":"object","title":"DeepResearchReport"},"DeepResearchReport-Output":{"properties":{"topic":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Topic"},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"title_ar":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title Ar"},"overview":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Overview"},"sections":{"anyOf":[{"items":{"$ref":"#/components/schemas/DeepResearchSection-Output"},"type":"array"},{"type":"null"}],"title":"Sections"},"sources":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Sources"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"},"markdown":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Markdown"}},"additionalProperties":true,"type":"object","title":"DeepResearchReport"},"DeepResearchRequest":{"properties":{"model":{"type":"string","const":"Fanar-Sadiq-2","title":"Model","description":"The model to use for deep research. Currently only `Fanar-Sadiq-2` is supported."},"input":{"type":"string","title":"Input","description":"The research topic or question to investigate."},"stream":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Stream","description":"Whether to stream the response. Defaults to `true`, or to `false` when `background` is set."},"depth":{"anyOf":[{"$ref":"#/components/schemas/DeepResearchDepth"},{"type":"null"}],"description":"Research depth: quick, standard, or comprehensive.","default":"standard"},"web_search":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Web Search","description":"Whether to include web search results.","default":false},"background":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Background","description":"Run the research as a background job. The response is a `Job` returned immediately; retrieve it with `GET /v1/sadiq/deep-research/{id}`. With `stream: true` as well, the job's events stream on this same connection and can be resumed with `GET /v1/sadiq/deep-research/{id}?stream=true`.","default":false}},"type":"object","required":["model","input"],"title":"DeepResearchRequest","example":{"model":"Fanar-Sadiq-2","input":"ما أهمية طلب العلم في الإسلام؟","depth":"quick","background":true}},"DeepResearchSection-Input":{"properties":{"heading":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Heading"},"heading_ar":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Heading Ar"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"},"mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mode"},"sources":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Sources"},"cited_sources":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Cited Sources"},"degraded":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Degraded"},"children":{"anyOf":[{"items":{"$ref":"#/components/schemas/DeepResearchSection-Input"},"type":"array"},{"type":"null"}],"title":"Children"}},"additionalProperties":true,"type":"object","title":"DeepResearchSection"},"DeepResearchSection-Output":{"properties":{"heading":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Heading"},"heading_ar":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Heading Ar"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"},"mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mode"},"sources":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Sources"},"cited_sources":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Cited Sources"},"degraded":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Degraded"},"children":{"anyOf":[{"items":{"$ref":"#/components/schemas/DeepResearchSection-Output"},"type":"array"},{"type":"null"}],"title":"Children"}},"additionalProperties":true,"type":"object","title":"DeepResearchSection"},"Error":{"properties":{"code":{"$ref":"#/components/schemas/ErrorCode"},"message":{"type":"string","title":"Message","default":"Internal server error"},"status":{"$ref":"#/components/schemas/ErrorStatus","default":500},"param":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Param"},"type":{"anyOf":[{"$ref":"#/components/schemas/ErrorContentFilterType"},{"type":"null"}]}},"type":"object","title":"Error"},"ErrorCode":{"type":"string","enum":["content_filter","invalid_authentication","invalid_authorization","rate_limit_reached","exceeded_quota","internal_server_error","overloaded","timeout","too_large","unprocessable","conflict","Not found","no_longer_supported","client_closed_request"],"title":"ErrorCode"},"ErrorContentFilterType":{"type":"string","enum":["safety","blocklist","incomplete"],"title":"ErrorContentFilterType"},"ErrorStatus":{"type":"integer","enum":[400,401,403,429,429,500,503,504,413,422,409,404,410,499],"title":"ErrorStatus"},"ImageGenerationItem-Input":{"properties":{"b64_json":{"type":"string","title":"B64 Json","description":"The base64-encoded JSON of the generated image."},"model":{"type":"string","title":"Model"},"revised":{"type":"boolean","title":"Revised","description":"Indicates whether the prompt was revised before generation."},"revised_prompt":{"type":"string","title":"Revised Prompt","description":"The prompt used for generation, which may be revised from the original prompt."}},"type":"object","required":["b64_json","model","revised","revised_prompt"],"title":"ImageGenerationItem"},"ImageGenerationItem-Output":{"properties":{"b64_json":{"type":"string","title":"B64 Json","description":"The base64-encoded JSON of the generated image."},"revised":{"type":"boolean","title":"Revised","description":"Indicates whether the prompt was revised before generation."},"revised_prompt":{"type":"string","title":"Revised Prompt","description":"The prompt used for generation, which may be revised from the original prompt."}},"type":"object","required":["b64_json","revised","revised_prompt"],"title":"ImageGenerationItem"},"ImageGenerationModels":{"type":"string","enum":["Fanar-Oryx-IG-2"],"title":"ImageGenerationModels"},"ImageGenerationRequest":{"properties":{"model":{"$ref":"#/components/schemas/ImageGenerationModels","description":"The model to use for the image generation."},"prompt":{"type":"string","title":"Prompt","description":"A text description of the desired image."},"revise":{"type":"boolean","title":"Revise","description":"Whether to automatically revise the prompt to enhance style, quality, and cultural alignment for improved generation results.","default":true}},"type":"object","required":["model","prompt"],"title":"ImageGenerationRequest","example":{"model":"Fanar-Oryx-IG-2","prompt":"A futuristic cityscape at sunset"}},"ImageGenerationResponse":{"properties":{"id":{"type":"string","title":"Id","description":"A unique identifier for the image generation."},"created":{"type":"integer","title":"Created","description":"The timestamp of when the image was created."},"data":{"items":{"$ref":"#/components/schemas/ImageGenerationItem-Output"},"type":"array","title":"Data","description":"A list of the generated image."}},"type":"object","required":["id","created","data"],"title":"ImageGenerationResponse"},"ImageURL":{"properties":{"url":{"type":"string","title":"Url"},"detail":{"type":"string","enum":["auto","low","high"],"title":"Detail"}},"type":"object","required":["url"],"title":"ImageURL"},"IncompleteDetails":{"properties":{"reason":{"$ref":"#/components/schemas/IncompleteReason"}},"type":"object","required":["reason"],"title":"IncompleteDetails"},"IncompleteReason":{"type":"string","enum":["content_filter"],"title":"IncompleteReason"},"Job":{"properties":{"id":{"type":"string","title":"Id","description":"The job id. Also returned as the `X-Id` header on create."},"object":{"$ref":"#/components/schemas/JobObject","default":"job"},"type":{"$ref":"#/components/schemas/JobTypeName"},"status":{"$ref":"#/components/schemas/JobStatus","description":"`queued` → `in_progress` → one of `completed`, `failed`, `cancelled`, `incomplete`. `incomplete` means the output was stopped by a content filter."},"incomplete_details":{"anyOf":[{"$ref":"#/components/schemas/IncompleteDetails"},{"type":"null"}]},"error":{"anyOf":[{"$ref":"#/components/schemas/JobError"},{"type":"null"}]},"progress_pct":{"type":"integer","title":"Progress Pct","description":"Research progress, 0-100. It can reach 100 while the last sentences are still being checked; only `status` says the job is done.","default":0},"attempt":{"type":"integer","title":"Attempt","description":"How many times this job has been started. Above 1 means it was restarted after a server failure, and its events replayed from the start.","default":0},"created_at":{"type":"integer","title":"Created At"},"started_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Started At"},"completed_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Completed At"},"updated_at":{"type":"integer","title":"Updated At","description":"When the job was last updated. A running job is updated every few seconds."},"cancel_source":{"anyOf":[{"$ref":"#/components/schemas/CancelSource"},{"type":"null"}]},"request":{"$ref":"#/components/schemas/DeepResearchJobRequest"},"result":{"anyOf":[{"$ref":"#/components/schemas/DeepResearchReport-Output"},{"type":"null"}],"description":"Set when `status` is `completed`: the report, exactly as the synchronous endpoint returns it."}},"type":"object","required":["id","type","status","created_at","updated_at","request"],"title":"Job"},"JobError":{"properties":{"code":{"$ref":"#/components/schemas/JobErrorCode"},"message":{"type":"string","title":"Message"}},"type":"object","required":["code","message"],"title":"JobError"},"JobErrorCode":{"type":"string","enum":["backend_task_lost","backend_failed","backend_unavailable","max_runtime_exceeded","internal_error"],"title":"JobErrorCode"},"JobObject":{"type":"string","enum":["job"],"title":"JobObject"},"JobStatus":{"type":"string","enum":["queued","in_progress","completed","failed","cancelled","incomplete"],"title":"JobStatus","description":"OpenAI's background-response vocabulary, verbatim."},"JobTypeName":{"type":"string","enum":["deep_research"],"title":"JobTypeName"},"LLM":{"type":"string","enum":["Fanar-S-1-7B","Fanar-C-1-8.7B","Fanar-C-2-27B"],"title":"LLM"},"MadhabEnum":{"type":"string","enum":["all","hanafi","maliki","shafii","hanbali"],"title":"MadhabEnum"},"ModelObject":{"type":"string","enum":["model"],"title":"ModelObject"},"ModelsResponse":{"properties":{"id":{"type":"string","title":"Id","description":"A unique identifier for the models."},"models":{"items":{"$ref":"#/components/schemas/AvailableModel"},"type":"array","title":"Models","description":"The available models."}},"type":"object","required":["id","models"],"title":"ModelsResponse"},"ModerationModels":{"type":"string","enum":["Fanar-Guard-2"],"title":"ModerationModels"},"PoemGenerationModels":{"type":"string","enum":["Fanar-Diwan"],"title":"PoemGenerationModels"},"PoemGenerationRequest":{"properties":{"model":{"$ref":"#/components/schemas/PoemGenerationModels","description":"The model to use for the poem generation."},"prompt":{"type":"string","title":"Prompt","description":"A text description of the desired poem."}},"type":"object","required":["model","prompt"],"title":"PoemGenerationRequest","example":{"model":"Fanar-Diwan","prompt":"Write a poem about the sea"}},"PoemGenerationResponse":{"properties":{"id":{"type":"string","title":"Id","description":"A unique identifier for the poem generation."},"poem":{"type":"string","title":"Poem","description":"The generated poem."}},"type":"object","required":["id","poem"],"title":"PoemGenerationResponse"},"PromptTokensDetails":{"additionalProperties":true,"properties":{"audio_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"title":"Audio Tokens"},"cached_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"title":"Cached Tokens"}},"title":"PromptTokensDetails","type":"object"},"QuranReciters":{"type":"string","enum":["abdul-basit","maher-al-muaiqly","mahmoud-al-husary"],"title":"QuranReciters"},"STTFormat":{"type":"string","enum":["text","srt","json"],"title":"STTFormat"},"STTModels":{"type":"string","enum":["Fanar-Aura-STT-1","Fanar-Aura-STT-LF-1"],"title":"STTModels"},"STTSegement":{"properties":{"speaker":{"type":"string","title":"Speaker","description":"The speaker label for the segment."},"start_time":{"type":"number","title":"Start Time","description":"The start time of the segment in seconds."},"end_time":{"type":"number","title":"End Time","description":"The end time of the segment in seconds."},"duration":{"type":"number","title":"Duration","description":"The duration of the segment in seconds."},"text":{"type":"string","title":"Text","description":"The transcribed text segment."}},"type":"object","required":["speaker","start_time","end_time","duration","text"],"title":"STTSegement"},"SadiqValidationModels":{"type":"string","enum":["Fanar-Sadiq-2"],"title":"SadiqValidationModels"},"SadiqValidationRequest":{"properties":{"model":{"$ref":"#/components/schemas/SadiqValidationModels","description":"The model to use for the validation."},"text":{"type":"string","title":"Text","description":"Input text to be checked for Quranic verses and hadith quotations."}},"type":"object","required":["model","text"],"title":"SadiqValidationRequest","example":{"model":"Fanar-Sadiq-2","text":"قال الله تعالى: إن الصلاة تنهى عن الفحشاء والمنكر. وقال النبي صلى الله عليه وسلم: إنما الأعمال بالنيات."}},"SadiqValidationResponse":{"properties":{"id":{"type":"string","title":"Id","description":"A unique identifier for this validation request."},"text":{"type":"string","title":"Text","description":"The input text with verified quotations tagged and referenced: Quranic verses are replaced with authenticated Quran text wrapped in `<quran_start>`/`<quran_end>` followed by a `[surah:ayah](quran.com)` markdown reference, and hadith are wrapped in `<hadith_start>`/`<hadith_end>` followed by a `[collection:number](sunnah.com)` reference. Quotations that cannot be verified are returned as plain, untagged text."}},"type":"object","required":["id","text"],"title":"SadiqValidationResponse"},"SafetyFilterRequest":{"properties":{"model":{"$ref":"#/components/schemas/ModerationModels","description":"The model to use for safety filtering."},"prompt":{"type":"string","title":"Prompt","description":"The prompt."},"response":{"type":"string","title":"Response","description":"The model's response to the prompt."}},"type":"object","required":["model","prompt","response"],"title":"SafetyFilterRequest","example":{"model":"Fanar-Guard-2","prompt":"What is the weather?","response":"The weather is sunny today."}},"SafetyFilterResponse":{"properties":{"safety":{"type":"number","title":"Safety","description":"The safety score for general safety aspects such as toxicity, violence, self-harm, etc."},"cultural_awareness":{"type":"number","title":"Cultural Awareness","description":"The cultural awareness score for aspects such as stereotypes, insensitive content, and bias."}},"type":"object","required":["safety","cultural_awareness"],"title":"SafetyFilterResponse"},"SourcesEnum":{"type":"string","enum":["islam_qa","islamweb","islamweb_fatwa","islamweb_consult","islamweb_article","islamweb_library","sunnah","quran","tafsir","dorar","islamonline","shamela"],"title":"SourcesEnum"},"SpeechToTextResponseJson":{"properties":{"segments":{"items":{"$ref":"#/components/schemas/STTSegement"},"type":"array","title":"Segments","description":"The list of segments for the transcribed text."}},"type":"object","required":["segments"],"title":"SpeechToTextResponseJson"},"SpeechToTextResponseWithJson-Input":{"properties":{"id":{"type":"string","title":"Id","description":"A unique identifier for the speech-to-text."},"json":{"$ref":"#/components/schemas/SpeechToTextResponseJson","description":"The transcribed text in JSON format."}},"type":"object","required":["id","json"],"title":"SpeechToTextResponseWithJson"},"SpeechToTextResponseWithJson-Output":{"properties":{"id":{"type":"string","title":"Id","description":"A unique identifier for the speech-to-text."},"json":{"$ref":"#/components/schemas/SpeechToTextResponseJson","description":"The transcribed text in JSON format."}},"type":"object","required":["id","json"],"title":"SpeechToTextResponseWithJson"},"SpeechToTextResponseWithSRT":{"properties":{"id":{"type":"string","title":"Id","description":"A unique identifier for the speech-to-text."},"srt":{"type":"string","title":"Srt","description":"The transcribed text in SRT format."}},"type":"object","required":["id","srt"],"title":"SpeechToTextResponseWithSRT"},"SpeechToTextResponseWithText":{"properties":{"id":{"type":"string","title":"Id","description":"A unique identifier for the speech-to-text."},"text":{"type":"string","title":"Text","description":"The transcribed text."}},"type":"object","required":["id","text"],"title":"SpeechToTextResponseWithText"},"TTSModels":{"type":"string","enum":["Fanar-Aura-TTS-2","Fanar-Sadiq-TTS-1"],"title":"TTSModels"},"TTSResponseFormat":{"type":"string","enum":["mp3","wav"],"title":"TTSResponseFormat"},"TextToSpeechRequest":{"properties":{"model":{"$ref":"#/components/schemas/TTSModels","description":"The model to use for the text-to-speech."},"input":{"type":"string","title":"Input","description":"The text to generate audio for."},"voice":{"type":"string","title":"Voice","description":"The voice to use for the text-to-speech. Details are below:\n<table style=\"min-width:600px\"><thead><tr><th nowrap width=\"160\">Voice</th><th nowrap width=\"80\">Gender</th><th nowrap width=\"180\">Supported Languages</th><th nowrap width=\"100\">Accent</th><th nowrap width=\"80\">Emotion</th></tr></thead><tbody><tr><td nowrap>Abdulrahman</td><td nowrap>Male</td><td><a href=\"https://chat.fanar.qa/api/sample-voices/ar/Abdulrahman\">Arabic</a></td><td nowrap>Standard</td><td nowrap>✓</td></tr><tr><td nowrap>Amelia</td><td nowrap>Female</td><td><a href=\"https://chat.fanar.qa/api/sample-voices/en/Amelia\">English</a></td><td nowrap>British</td><td nowrap>—</td></tr><tr><td nowrap>Emily</td><td nowrap>Female</td><td><a href=\"https://chat.fanar.qa/api/sample-voices/en/Emily\">English</a></td><td nowrap>American</td><td nowrap>—</td></tr><tr><td nowrap>Hamad</td><td nowrap>Male</td><td><a href=\"https://chat.fanar.qa/api/sample-voices/ar/Hamad\">Arabic</a></td><td nowrap>Standard</td><td nowrap>—</td></tr><tr><td nowrap>Harry</td><td nowrap>Male</td><td><a href=\"https://chat.fanar.qa/api/sample-voices/en/Harry\">English</a></td><td nowrap>British</td><td nowrap>—</td></tr><tr><td nowrap>Huda</td><td nowrap>Female</td><td><a href=\"https://chat.fanar.qa/api/sample-voices/ar/Huda\">Arabic</a></td><td nowrap>Standard</td><td nowrap>—</td></tr><tr><td nowrap>Jake</td><td nowrap>Male</td><td><a href=\"https://chat.fanar.qa/api/sample-voices/en/Jake\">English</a></td><td nowrap>American</td><td nowrap>—</td></tr><tr><td nowrap>Jasim</td><td nowrap>Male</td><td><a href=\"https://chat.fanar.qa/api/sample-voices/ar/Jasim\">Arabic</a></td><td nowrap>Standard</td><td nowrap>—</td></tr><tr><td nowrap>Noor</td><td nowrap>Female</td><td><a href=\"https://chat.fanar.qa/api/sample-voices/ar/Noor\">Arabic</a></td><td nowrap>Standard</td><td nowrap>—</td></tr><tr><td nowrap>Radwa</td><td nowrap>Female</td><td><a href=\"https://chat.fanar.qa/api/sample-voices/ar/Radwa\">Arabic</a></td><td nowrap>Standard</td><td nowrap>✓</td></tr></tbody></table>","enum":["Abdulrahman","Amelia","Emily","Hamad","Harry","Huda","Jake","Jasim","Noor","Radwa"]},"response_format":{"$ref":"#/components/schemas/TTSResponseFormat","description":"The format of the output audio. Supported formats are `mp3` and `wav`.","default":"mp3"},"quran_reciter":{"$ref":"#/components/schemas/QuranReciters","description":"The Quran reciter to use when using Fanar-Sadiq-TTS-1 model for Quranic text.","default":"abdul-basit"},"with_emotion":{"type":"boolean","title":"With Emotion","description":"Enable emotional speech synthesis. **Only applicable to `Fanar-Aura-TTS-2` and to voices where `emotion: true` in GET /v1/voices.** When the selected voice does not support emotion, or when used with `Fanar-Sadiq-TTS-1`, the request is rejected with a 422 error. Defaults to false.","default":false},"stream":{"type":"boolean","title":"Stream","description":"Stream the audio as it is generated. Supported for both `wav` and `mp3`.","default":false}},"type":"object","required":["model","input","voice"],"title":"TextToSpeechRequest","example":{"model":"Fanar-Aura-TTS-2","input":"Hello, welcome to Fanar!","voice":"Harry"}},"TokenizationRequest":{"properties":{"content":{"type":"string","title":"Content"},"model":{"$ref":"#/components/schemas/LLM"}},"type":"object","required":["content","model"],"title":"TokenizationRequest","example":{"content":"Hello, how are you?","model":"Fanar-S-1-7B"}},"TokenizationResponse":{"properties":{"id":{"type":"string","title":"Id","description":"A unique identifier for the tokenization."},"tokens":{"type":"integer","title":"Tokens"},"max_request_tokens":{"type":"integer","title":"Max Request Tokens"}},"type":"object","required":["id","tokens","max_request_tokens"],"title":"TokenizationResponse"},"TopLogprob":{"properties":{"token":{"type":"string","title":"Token"},"bytes":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"title":"Bytes"},"logprob":{"type":"number","title":"Logprob"}},"additionalProperties":true,"type":"object","required":["token","logprob"],"title":"TopLogprob"},"TranslationLangPairs":{"type":"string","enum":["en-ar","ar-en"],"title":"TranslationLangPairs"},"TranslationModels":{"type":"string","enum":["Fanar-Shaheen-MT-1","Fanar-Shaheen-MT-2"],"title":"TranslationModels"},"TranslationPreprocessing":{"type":"string","enum":["default","preserve_html","preserve_whitespace","preserve_whitespace_and_html"],"title":"TranslationPreprocessing"},"TranslationRequest":{"properties":{"model":{"$ref":"#/components/schemas/TranslationModels","description":"The model to use for the translation."},"text":{"type":"string","title":"Text","description":"The text to translate. It must not exceed 4,000 words."},"langpair":{"$ref":"#/components/schemas/TranslationLangPairs","description":"The source-target language pair for translation, the current allowed possible values are:<br/>- <b>en-ar</b>: for English to Arabic<br/>- <b>ar-en</b>: for Arabic to English"},"preprocessing":{"anyOf":[{"$ref":"#/components/schemas/TranslationPreprocessing"},{"type":"null"}],"description":"How to preprocess the text before translation:<br/>- <b>default</b>: Splits all sentences by natural punctuation (full stops, question marks, etc.), trims away extra whitespace, and removes HTML tags.<br/>- <b>preserve_html</b>: Does the same as “default”, but tries to preserve HTML tags.<br/>- <b>preserve_whitespace</b>: Aggressively tries to maintain all extra leading/trailing whitespaces and joins sentences across newlines to translate fixed-width content, for example.<br/>- <b>preserve_whitespace_and_html</b>: Combines the previous two.","default":"default"}},"type":"object","required":["model","text","langpair"],"title":"TranslationRequest","example":{"model":"Fanar-Shaheen-MT-2","text":"Hello, how are you?","langpair":"en-ar"}},"TranslationResponse":{"properties":{"id":{"type":"string","title":"Id","description":"A unique identifier for the translation."},"text":{"type":"string","title":"Text","description":"The translated text"}},"type":"object","required":["id","text"],"title":"TranslationResponse"},"URL":{"properties":{"url":{"type":"string","title":"Url"}},"type":"object","required":["url"],"title":"URL"},"VideoURL":{"properties":{"url":{"type":"string","title":"Url"}},"type":"object","required":["url"],"title":"VideoURL"},"Voice":{"properties":{"name":{"type":"string","title":"Name","description":"The English name of the voice. This is the identifier passed to the TTS endpoint.","examples":["Amelia"]},"name_ar":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name Ar","description":"The Arabic display name of the voice, when available.","examples":["أميليا"]},"gender":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gender","description":"Gender label of the voice (e.g., 'Male', 'Female').","examples":["Female"]},"accent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Accent","description":"Accent label of the voice (e.g., 'British', 'Gulf', 'American', 'Standard').","examples":["British"]},"languages":{"items":{"type":"string"},"type":"array","title":"Languages","description":"Supported language codes (e.g., 'en', 'ar').","examples":[["en"]]},"type":{"type":"string","enum":["public","personal"],"title":"Type","description":"Whether this is a built-in public voice or a personalized voice registered for this API key.","examples":["public"]},"emotion":{"type":"boolean","title":"Emotion","description":"Whether this voice supports emotional speech synthesis. When true, you may set `with_emotion: true` on POST /v1/audio/speech to enable emotional rendering.","default":false,"examples":[true]}},"type":"object","required":["name","type"],"title":"Voice","example":{"accent":"British","emotion":false,"gender":"Female","languages":["en"],"name":"Amelia","name_ar":"أميليا","type":"public"}},"VoiceResponse":{"properties":{"voices":{"items":{"$ref":"#/components/schemas/Voice"},"type":"array","title":"Voices","description":"Available voices. Always includes the built-in public voices. Includes personalized voices registered for this API key when voice personalization is authorized."}},"type":"object","required":["voices"],"title":"VoiceResponse","example":{"voices":[{"accent":"British","emotion":false,"gender":"Female","languages":["en"],"name":"Amelia","name_ar":"أميليا","type":"public"},{"accent":"Gulf","emotion":false,"gender":"Male","languages":["ar"],"name":"Hamad","name_ar":"حمد","type":"public"},{"emotion":false,"languages":[],"name":"MyVoice","type":"personal"}]}},"TokenChunk":{"properties":{"id":{"description":"A unique identifier for the chat completion","title":"Id","type":"string"},"object":{"default":"chat.completion.chunk","description":"The object type","title":"Object","type":"string"},"created":{"description":"The Unix timestamp (in seconds) of when the chat completion was created.","title":"Created","type":"integer"},"model":{"description":"The model used for the chat completion.","title":"Model","type":"string"},"choices":{"description":"A list of chat completion choices.Can be more than one if `n` is greater than 1.","items":{"$ref":"#/components/schemas/ChoiceToken"},"title":"Choices","type":"array"}},"required":["id","created","model","choices"],"title":"TokenChunk","type":"object"},"ChoiceToken":{"properties":{"index":{"default":0,"title":"Index","type":"integer"},"finish_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"The reason the model stopped generating","title":"Finish Reason"},"delta":{"$ref":"#/components/schemas/DeltaContent"}},"required":["delta"],"title":"ChoiceToken","type":"object"},"DeltaContent":{"properties":{"content":{"example":"Hello","title":"Content","type":"string"}},"required":["content"],"title":"DeltaContent","type":"object"},"ToolCallChunk":{"properties":{"id":{"description":"A unique identifier for the chat completion","title":"Id","type":"string"},"object":{"default":"chat.completion.chunk","description":"The object type","title":"Object","type":"string"},"created":{"description":"The Unix timestamp (in seconds) of when the chat completion was created.","title":"Created","type":"integer"},"model":{"description":"The model used for the chat completion.","title":"Model","type":"string"},"choices":{"description":"A list of chat completion choices.Can be more than one if `n` is greater than 1.","items":{"$ref":"#/components/schemas/ChoiceToolCall"},"title":"Choices","type":"array"}},"required":["id","created","model","choices"],"title":"ToolCallChunk","type":"object"},"ChoiceToolCall":{"properties":{"index":{"default":0,"title":"Index","type":"integer"},"finish_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"The reason the model stopped generating","title":"Finish Reason"},"delta":{"$ref":"#/components/schemas/DeltaToolCalls"}},"required":["delta"],"title":"ChoiceToolCall","type":"object"},"DeltaToolCalls":{"properties":{"tool_calls":{"description":"The list of tool calls that need to be executed.","items":{"$ref":"#/components/schemas/ToolCallData"},"title":"Tool Calls","type":"array"}},"required":["tool_calls"],"title":"DeltaToolCalls","type":"object"},"FunctionData":{"description":"Function call details","properties":{"name":{"description":"The name of the function to call","title":"Name","type":"string"},"arguments":{"description":"The arguments to pass to the function as JSON string","title":"Arguments","type":"string"}},"required":["name","arguments"],"title":"FunctionData","type":"object"},"ToolCallData":{"description":"Tool call in delta.tool_calls","properties":{"index":{"description":"The index of the tool call in the list","title":"Index","type":"integer"},"id":{"description":"The unique identifier for the tool call","title":"Id","type":"string"},"type":{"default":"function","description":"The type of the tool call","title":"Type","type":"string"},"function":{"$ref":"#/components/schemas/FunctionData"}},"required":["index","id","function"],"title":"ToolCallData","type":"object"},"ToolResultChunk":{"properties":{"id":{"description":"A unique identifier for the chat completion","title":"Id","type":"string"},"object":{"default":"chat.completion.chunk","description":"The object type","title":"Object","type":"string"},"created":{"description":"The Unix timestamp (in seconds) of when the chat completion was created.","title":"Created","type":"integer"},"model":{"description":"The model used for the chat completion.","title":"Model","type":"string"},"choices":{"description":"A list of chat completion choices.Can be more than one if `n` is greater than 1.","items":{"$ref":"#/components/schemas/ChoiceToolResult"},"title":"Choices","type":"array"}},"required":["id","created","model","choices"],"title":"ToolResultChunk","type":"object"},"ChoiceToolResult":{"properties":{"index":{"default":0,"title":"Index","type":"integer"},"finish_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"The reason the model stopped generating","title":"Finish Reason"},"delta":{"$ref":"#/components/schemas/DeltaToolResult"}},"required":["delta"],"title":"ChoiceToolResult","type":"object"},"DeltaToolResult":{"properties":{"tool_result":{"$ref":"#/components/schemas/ToolResultData","description":"The list of tool call results returned by the executed tools."}},"required":["tool_result"],"title":"DeltaToolResult","type":"object"},"ToolResultData":{"description":"Tool result data","properties":{"id":{"description":"The unique identifier for the tool call","title":"Id","type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"The name of the tool called","title":"Name"},"arguments":{"additionalProperties":true,"description":"The arguments passed to the tool","title":"Arguments","type":"object"},"result":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"The result returned by the tool","title":"Result"},"structured_content":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"The structured content returned by the tool","title":"Structured Content"},"is_error":{"default":false,"description":"Indicates if there was an error during the tool call","title":"Is Error","type":"boolean"}},"required":["id"],"title":"ToolResultData","type":"object"},"ProgressChunk":{"properties":{"id":{"description":"A unique identifier for the chat completion","title":"Id","type":"string"},"object":{"default":"chat.completion.chunk","description":"The object type","title":"Object","type":"string"},"created":{"description":"The Unix timestamp (in seconds) of when the chat completion was created.","title":"Created","type":"integer"},"model":{"description":"The model used for the chat completion.","title":"Model","type":"string"},"progress":{"$ref":"#/components/schemas/ProgressData","description":"Progress event indicating current processing step"}},"required":["id","created","model","progress"],"title":"ProgressChunk","type":"object"},"ProgressData":{"description":"Progress event data","properties":{"message":{"$ref":"#/components/schemas/ProgressMessage","description":"Bilingual progress message indicating current processing step"}},"required":["message"],"title":"ProgressData","type":"object"},"ProgressMessage":{"description":"Bilingual progress message","properties":{"en":{"description":"Progress message in English","title":"En","type":"string"},"ar":{"description":"Progress message in Arabic","title":"Ar","type":"string"}},"required":["en","ar"],"title":"ProgressMessage","type":"object"},"ReportChunk":{"description":"Deep research's terminal payload: the finished structured report.\n\nEmitted once, near the end of a deep research stream. Render this rather than the\nconcatenated token deltas: the deltas are the prose as it was drafted, the report is\nthe structured, cited result.","properties":{"id":{"description":"A unique identifier for the chat completion","title":"Id","type":"string"},"object":{"default":"chat.completion.chunk","description":"The object type","title":"Object","type":"string"},"created":{"description":"The Unix timestamp (in seconds) of when the chat completion was created.","title":"Created","type":"integer"},"model":{"description":"The model used for the chat completion.","title":"Model","type":"string"},"report":{"$ref":"#/components/schemas/DeepResearchReport","description":"The completed deep research report"}},"required":["id","created","model","report"],"title":"ReportChunk","type":"object"},"DeepResearchReport":{"additionalProperties":true,"properties":{"topic":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Topic"},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Language"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Title"},"title_ar":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Title Ar"},"overview":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Overview"},"sections":{"anyOf":[{"items":{"$ref":"#/components/schemas/DeepResearchSection"},"type":"array"},{"type":"null"}],"default":null,"title":"Sections"},"sources":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"default":null,"title":"Sources"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"title":"Metadata"},"markdown":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Markdown"}},"title":"DeepResearchReport","type":"object"},"DeepResearchSection":{"additionalProperties":true,"properties":{"heading":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Heading"},"heading_ar":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Heading Ar"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Content"},"mode":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Mode"},"sources":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"default":null,"title":"Sources"},"cited_sources":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"default":null,"title":"Cited Sources"},"degraded":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":null,"title":"Degraded"},"children":{"anyOf":[{"items":{"$ref":"#/components/schemas/DeepResearchSection"},"type":"array"},{"type":"null"}],"default":null,"title":"Children"}},"title":"DeepResearchSection","type":"object"},"DoneChunk":{"properties":{"id":{"description":"A unique identifier for the chat completion","title":"Id","type":"string"},"object":{"default":"chat.completion.chunk","description":"The object type","title":"Object","type":"string"},"created":{"description":"The Unix timestamp (in seconds) of when the chat completion was created.","title":"Created","type":"integer"},"model":{"description":"The model used for the chat completion.","title":"Model","type":"string"},"choices":{"description":"List of choices with final delta","items":{"$ref":"#/components/schemas/ChoiceFinal"},"title":"Choices","type":"array"},"usage":{"anyOf":[{"$ref":"#/components/schemas/CompletionUsage"},{"type":"null"}],"default":null,"description":"Usage statistics for the completion request."},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Additional metadata associated with the completion.","title":"Metadata"}},"required":["id","created","model","choices"],"title":"DoneChunk","type":"object"},"ChoiceFinal":{"properties":{"index":{"default":0,"title":"Index","type":"integer"},"finish_reason":{"default":"stop","title":"Finish Reason","type":"string"},"delta":{"$ref":"#/components/schemas/DeltaReferences"}},"required":["delta"],"title":"ChoiceFinal","type":"object"},"DeltaReferences":{"properties":{"references":{"anyOf":[{"items":{"$ref":"#/components/schemas/ChatCompletionChoiceMessageReference"},"type":"array"},{"type":"null"}],"default":null,"description":"The list of references used in the response","title":"References"}},"title":"DeltaReferences","type":"object"},"ErrorChunk":{"description":"Error chunk","properties":{"id":{"description":"A unique identifier for the chat completion","title":"Id","type":"string"},"object":{"default":"chat.completion.chunk","description":"The object type","title":"Object","type":"string"},"created":{"description":"The Unix timestamp (in seconds) of when the chat completion was created.","title":"Created","type":"integer"},"model":{"description":"The model used for the chat completion.","title":"Model","type":"string"},"choices":{"items":{"$ref":"#/components/schemas/ChoiceError"},"title":"Choices","type":"array"}},"required":["id","created","model","choices"],"title":"ErrorChunk","type":"object"},"ChoiceError":{"properties":{"index":{"default":0,"title":"Index","type":"integer"},"delta":{"$ref":"#/components/schemas/DeltaContent"},"finish_reason":{"default":"error","title":"Finish Reason","type":"string"}},"required":["delta"],"title":"ChoiceError","type":"object"}},"securitySchemes":{"Bearer":{"type":"http","scheme":"bearer","description":"Provide your API key in the Authorization header using the Bearer scheme."}}},"security":[{"Bearer":[]}],"tags":[{"name":"Authentication","description":"All API endpoints require a **Bearer** token. Include it in the `Authorization` header:\n\n```\nAuthorization: Bearer YOUR_API_KEY\n```"}]}