Skip to main content
POST
استخدم هذا المسار لتحرير صورة واحدة أو أكثر باستخدام نماذج الصور من Grok. يستخدم نص الطلب application/json.

توفير إدخال الصورة

  • أرسل واحدًا فقط من image أو images.
  • استخدم image لصورة مصدر واحدة.
  • استخدم images لصورتَي مصدر أو ثلاث صور مصدر.
  • في كل كائن صورة، استخدم url لعنوان URL عام أو معرّف URI للبيانات. يُعد image_url اسمًا مستعارًا للتوافق مع url.
  • استخدم aspect_ratio للتحكم في شكل المخرجات لتعديلات الصور المتعددة.
اختر معرّف نموذج صور Grok من صفحة النماذج. تستخدم أمثلة API ‏grok-imagine-image-quality.
أرسل طلبات تحرير صور Grok بصيغة JSON. لا تمثل بيانات النموذج متعدد الأجزاء شكل هذا الطلب.
ترسل طريقة OpenAI SDK ‏images.edit() بيانات نموذج متعدد الأجزاء. استخدم طلب HTTP مباشرًا لتعديلات صور Grok بصيغة JSON. للاطلاع على تفاصيل مَعلمات المزوّد، راجع دليل تحرير الصور من xAI.

التفويضات

Authorization
string
header
مطلوب

Use your CometAPI API key as the bearer value.

الجسم

application/json
model
enum<string>
مطلوب

The Grok image model ID. See the Models page for available model IDs.

الخيارات المتاحة:
grok-imagine-image,
grok-imagine-image-quality
مثال:

"grok-imagine-image-quality"

prompt
string
مطلوب

A text instruction that describes the requested edit.

Minimum string length: 1
مثال:

"Replace the daytime sky with a soft sunset and preserve the building"

image
object
مطلوب

One source image. Use this field instead of images.

images
object[]

Two or three source images. Use this field instead of image.

Required array length: 2 - 3 elements

A source image represented by url or the compatibility alias image_url.

n
integer
افتراضي:1

The number of edited images to generate. Use an integer from 1 through 10.

النطاق المطلوب: 1 <= x <= 10
aspect_ratio
enum<string>

The 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"

resolution
enum<string>

The requested output resolution.

الخيارات المتاحة:
1k,
2k
مثال:

"1k"

response_format
enum<string>
افتراضي:url

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

الاستجابة

200 - application/json

The edited image results.

data
object[]
مطلوب

The edited images.

Minimum array length: 1
usage
object
مطلوب

Usage details for the request.