تحرير الصور باستخدام Grok
حرّر صورة واحدة أو أكثر باستخدام Grok عبر إرسال عناوين URL للصور أو معرّفات URI للبيانات في طلب JSON.
application/json.
توفير إدخال الصورة
- أرسل واحدًا فقط من
imageأوimages. - استخدم
imageلصورة مصدر واحدة. - استخدم
imagesلصورتَي مصدر أو ثلاث صور مصدر. - في كل كائن صورة، استخدم
urlلعنوان URL عام أو معرّف URI للبيانات. يُعدimage_urlاسمًا مستعارًا للتوافق معurl. - استخدم
aspect_ratioللتحكم في شكل المخرجات لتعديلات الصور المتعددة.
grok-imagine-image-quality.
ترسل طريقة OpenAI SDK images.edit() بيانات نموذج متعدد الأجزاء. استخدم طلب HTTP مباشرًا لتعديلات صور Grok بصيغة JSON.
للاطلاع على تفاصيل مَعلمات المزوّد، راجع دليل تحرير الصور من xAI.التفويضات
Use your CometAPI API key as the bearer value.
الجسم
- Option 1
- Option 2
The Grok image model ID. See the Models page for available model IDs.
grok-imagine-image, grok-imagine-image-quality "grok-imagine-image-quality"
A text instruction that describes the requested edit.
1"Replace the daytime sky with a soft sunset and preserve the building"
One source image. Use this field instead of images.
- Option 1
- Option 2
Two or three source images. Use this field instead of image.
2 - 3 elementsA source image represented by url or the compatibility alias image_url.
- Option 1
- Option 2
The number of edited images to generate. Use an integer from 1 through 10.
1 <= x <= 10The output shape for a multi-image edit.
1:1, 3:4, 4:3, 16:9, 2:3, 3:2, 9:19.5, 19.5:9, 9:20, 20:9, 1:2 "16:9"
The requested output resolution.
1k, 2k "1k"
The image representation in each response item. Use url for a temporary download URL or b64_json for Base64-encoded image bytes.
url, b64_json