> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apimart.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Grok Imagine 1.5 Bildbearbeitung

>  - Asynchroner Verarbeitungsmodus, gibt eine Aufgaben-ID für nachfolgende Abfragen zurück
- Hochwertige Bildbearbeitung basierend auf Referenzbildern, unterstützt mehrsprachige Prompts
- Links zu generierten Bildern sind 24 Stunden gültig, bitte speichern Sie sie umgehend 

<Info>
  **Hinweis zur Modellnamen-Kompatibilität**: Diese Schnittstelle unterstützt auch den Alias `grok-imagine-1.5-edit-ext`, der `grok-imagine-1.5-edit-apimart` entspricht. Beide sind austauschbar und liefern identische Ergebnisse.
</Info>

<RequestExample>
  ```bash cURL theme={null}
  # model kann "grok-imagine-1.5-edit-apimart" sein, alternativ auch der Alias "grok-imagine-1.5-edit-ext"
  curl --request POST \
    --url https://api.apimart.ai/v1/images/edits \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "grok-imagine-1.5-edit-apimart",
      "prompt": "Change the background to a starry sky, keep the main subject",
      "image_urls": ["https://example.com/original.png"],
      "n": 1
    }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.apimart.ai/v1/images/edits"

  payload = {
      "model": "grok-imagine-1.5-edit-apimart",
      "prompt": "Change the background to a starry sky, keep the main subject",
      "image_urls": ["https://example.com/original.png"],
      "n": 1
  }

  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }

  response = requests.post(url, json=payload, headers=headers)

  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const url = "https://api.apimart.ai/v1/images/edits";

  const payload = {
    model: "grok-imagine-1.5-edit-apimart",
    prompt: "Change the background to a starry sky, keep the main subject",
    image_urls: ["https://example.com/original.png"],
    n: 1
  };

  const headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
  };

  fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(payload)
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": 200,
    "data": [
      {
        "status": "submitted",
        "task_id": "task_01JNXXXXXXXXXXXXXXXXXX"
      }
    ]
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "code": 400,
      "message": "Invalid request parameters",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": 401,
      "message": "Authentication failed, please check your API key",
      "type": "authentication_error"
    }
  }
  ```

  ```json 402 theme={null}
  {
    "error": {
      "code": 402,
      "message": "Insufficient balance, please top up and try again",
      "type": "payment_required"
    }
  }
  ```

  ```json 403 theme={null}
  {
    "error": {
      "code": 403,
      "message": "Access forbidden, you do not have permission to access this resource",
      "type": "permission_error"
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": 429,
      "message": "Too many requests, please try again later",
      "type": "rate_limit_error"
    }
  }
  ```

  ```json 500 theme={null}
  {
    "error": {
      "code": 500,
      "message": "Internal server error, please try again later",
      "type": "server_error"
    }
  }
  ```

  ```json 502 theme={null}
  {
    "error": {
      "code": 502,
      "message": "Bad gateway, server temporarily unavailable",
      "type": "bad_gateway"
    }
  }
  ```
</ResponseExample>

## Autorisierung

<ParamField header="Authorization" type="string" required>
  Alle APIs erfordern eine Bearer-Token-Authentifizierung

  API-Key abrufen:

  Besuchen Sie die [API-Key-Verwaltungsseite](https://apimart.ai/keys), um Ihren API-Key zu erhalten

  Fügen Sie ihn dem Request-Header hinzu:

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## Body

<ParamField body="model" type="string" default="grok-imagine-1.5-edit-apimart" required>
  Name des Bildbearbeitungsmodells

  Unterstützte Modelle:

  * `grok-imagine-1.5-edit-apimart` – Grok-Bildbearbeitung (kompatibler Alias `grok-imagine-1.5-edit-ext`)

  Beispiel: `"grok-imagine-1.5-edit-apimart"`

  <Note>
    Zur Kompatibilität mit älteren Aufrufen kann der Alias `grok-imagine-1.5-edit-ext` (entspricht `grok-imagine-1.5-edit-apimart`) weiterhin verwendet werden.
  </Note>
</ParamField>

<ParamField body="prompt" type="string" required>
  Textbeschreibung für die Bildbearbeitung, unterstützt mehrere Sprachen
</ParamField>

<ParamField body="image_urls" type="string[]" required>
  Array von Quellbild-URLs. Das System verwendet das erste Bild im Array als Bearbeitungsreferenz.

  Unterstützt `https://`-Links oder das Format `data:image/...;base64,...`.
</ParamField>

<ParamField body="n" type="integer" default={1}>
  Anzahl der zu generierenden Bilder

  Bereich: 1–10 (Minimum 1, Maximum 10)
</ParamField>

## Response

<ResponseField name="code" type="integer">
  Antwort-Statuscode
</ResponseField>

<ResponseField name="data" type="array">
  Antwortdaten-Array

  <Expandable title="Eigenschaften">
    <ResponseField name="status" type="string">
      Aufgabenstatus

      * `submitted` – Eingereicht
    </ResponseField>

    <ResponseField name="task_id" type="string">
      Eindeutige Aufgaben-ID
    </ResponseField>
  </Expandable>
</ResponseField>

## Anwendungsfälle

### Fall 1: Hintergrundbearbeitung

```json theme={null}
{
  "model": "grok-imagine-1.5-edit-apimart",
  "prompt": "Change the background to a starry sky, keep the main subject",
  "image_urls": ["https://example.com/original.png"]
}
```

### Fall 2: Stilübertragung

```json theme={null}
{
  "model": "grok-imagine-1.5-edit-apimart",
  "prompt": "Convert the image to cyberpunk style",
  "image_urls": ["https://example.com/original.png"],
  "n": 2
}
```
