Alborihi Ai agent|وكيل الذكاء الإصطناعي

🌐 Public REST API

استخدم نماذج Lovable AI من أي تطبيق خارجي عبر REST بسيط. كل النقاط محمية بمفتاح PUBLIC_API_KEY الذي تضيفه في الإعدادات.

🔑 التهيئة

  1. أضف سرّاً اسمه PUBLIC_API_KEY في إعدادات Lovable Cloud (أي قيمة عشوائية قوية).
  2. أرسل تلك القيمة في رأس x-api-key مع كل طلب.
Base URL: https://your-domain

💬 POST /api/public/v1/chat

OpenAI-compatible chat completion عبر Lovable AI Gateway.

curl -X POST https://your-domain/api/public/v1/chat \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_PUBLIC_API_KEY" \
  -d '{
    "model": "google/gemini-2.5-flash",
    "messages": [{ "role": "user", "content": "Hello!" }]
  }'

🖼️ POST /api/public/v1/image

ولّد صورة وسترجع كـ data URL.

curl -X POST https://your-domain/api/public/v1/image \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_PUBLIC_API_KEY" \
  -d '{ "prompt": "A futuristic city at dusk" }'

🔊 POST /api/public/v1/tts

ترجمة نص إلى MP3 مجاناً (Google Translate engine).

curl -X POST https://your-domain/api/public/v1/tts \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_PUBLIC_API_KEY" \
  -d '{ "text": "مرحباً بالعالم", "lang": "ar" }' \
  --output speech.mp3

ملاحظة: كل المسارات تدعم CORS (*) لذا يمكنك استدعاؤها مباشرة من المتصفح.