نمونه درخواست برای متن، تصویر، ویرایش تصویر، صدا و ویدیو

همه قابلیت‌ها می‌توانند از همان endpoint اصلی ارسال شوند. کلاینت باید مدل مناسب را از /models انتخاب کند و نوع خروجی مورد انتظار را در Payload مشخص کند.

نمونه عمومی با کلید جایگزین:

curl -X POST "https://portal-ai.net/wp-json/v1/chat/completions" \
  -H "Authorization: Bearer YOUR_PORTAL_AI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model":"MODEL_ID",
    "messages":[{"role":"user","content":"سلام"}]
  }'

نمونه عمومی

تولید متن
curl -X POST "https://portal-ai.net/wp-json/v1/chat/completions" \
  -H "Authorization: Bearer YOUR_PORTAL_AI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model":"gpt-5.2",
    "messages":[{"role":"user","content":"یک متن تبلیغاتی کوتاه بنویس"}],
    "temperature":0.7
  }'
تولید تصویر
{
  "model":"image-generator-model",
  "modalities":["image"],
  "messages":[{"role":"user","content":"یک بنر تبلیغاتی مدرن برای سایت هوش مصنوعی بساز"}],
  "size":"1024x1024"
}
ویرایش تصویر
{
  "model":"image-edit-model",
  "modalities":["image"],
  "task":"image_edit",
  "messages":[{"role":"user","content":"پس‌زمینه تصویر را روشن‌تر کن"}],
  "files":[{"type":"image","url":"https://example.com/input.png"}]
}
تولید صدا
{
  "model":"tts-or-audio-model",
  "modalities":["audio"],
  "messages":[{"role":"user","content":"این متن را با صدای طبیعی فارسی بخوان"}],
  "voice":"default"
}
تولید ویدیو
{
  "model":"video-generation-model",
  "modalities":["video"],
  "messages":[{"role":"user","content":"یک ویدیوی ۵ ثانیه‌ای از حرکت دوربین روی محصول بساز"}],
  "duration":5
}