> ## 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.

# FLUX 3 Videogenerierung

>  - Asynchroner Verarbeitungsmodus, gibt eine Task-ID für spätere Abfragen zurück
- Einheitlicher Einstieg: Text-to-Video / Image-to-Video / Videofortsetzung / Draft-Zweistufig
- Ausgabe H.264 + AAC mit synchronem Audio, Dauer 5~20 Sekunden
- Auflösung hd / fhd, sieben Seitenverhältnisse 

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.apimart.ai/v1/videos/generations \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "flux-3-video",
      "prompt": "An orange cat jumps onto a sunlit wooden table, its tail brushes a glass that wobbles but does not fall. Cinematic, shallow depth of field.",
      "duration": 5,
      "resolution": "hd",
      "aspect_ratio": "16:9"
    }'
  ```

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

  url = "https://api.apimart.ai/v1/videos/generations"

  payload = {
      "model": "flux-3-video",
      "prompt": "An orange cat jumps onto a sunlit wooden table, its tail brushes a glass that wobbles but does not fall. Cinematic, shallow depth of field.",
      "duration": 5,
      "resolution": "hd",
      "aspect_ratio": "16:9",
  }

  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/videos/generations";

  const payload = {
    model: "flux-3-video",
    prompt: "An orange cat jumps onto a sunlit wooden table, its tail brushes a glass that wobbles but does not fall. Cinematic, shallow depth of field.",
    duration: 5,
    resolution: "hd",
    aspect_ratio: "16:9",
  };

  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));
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "fmt"
      "io/ioutil"
      "net/http"
  )

  func main() {
      url := "https://api.apimart.ai/v1/videos/generations"

      payload := map[string]interface{}{
          "model":        "flux-3-video",
          "prompt":       "An orange cat jumps onto a sunlit wooden table",
          "duration":     5,
          "resolution":   "hd",
          "aspect_ratio": "16:9",
      }

      jsonData, _ := json.Marshal(payload)
      req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
      req.Header.Set("Authorization", "Bearer <token>")
      req.Header.Set("Content-Type", "application/json")

      client := &http.Client{}
      resp, err := client.Do(req)
      if err != nil {
          panic(err)
      }
      defer resp.Body.Close()

      body, _ := ioutil.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```
</RequestExample>

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

  ```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 account balance, please top up and try again",
      "type": "payment_required"
    }
  }
  ```

  ```json 422 theme={null}
  {
    "error": {
      "code": 422,
      "message": "Parameter conflict or invalid value",
      "type": "invalid_request_error"
    }
  }
  ```

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

## Autorisierung

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

  Holen Sie Ihren API-Key von der [API-Key-Verwaltungsseite](https://apimart.ai/keys):

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

## Generierungsmodi

`flux-3-video` ist ein **einheitlicher Einstieg**: Der Modus wird aus den Feldern abgeleitet oder explizit mit `mode` gesetzt.

| Modus                      | Auslöser                               | Hinweise                                                   |
| -------------------------- | -------------------------------------- | ---------------------------------------------------------- |
| **Text-to-Video (t2v)**    | nur `prompt`                           | Reiner Text                                                |
| **Image-to-Video (i2v)**   | `image_urls`                           | Keyframes; siehe unten                                     |
| **Videofortsetzung (v2v)** | `video_url` / `video_urls`             | Höherer Stückpreis; bei Bild und Video gewinnt Fortsetzung |
| **Draft → Final**          | `draft:true` oder `draft_from_task_id` | Günstige Vorschau, dann Final zum vollen Preis             |

`mode`-Werte: `t2v` / `i2v` / `v2v` / `draft_enhance` oder offizielle Schreibweisen `text-to-video` / `image-continuation` / `video-continuation`. **Explizites `mode` hat höchste Priorität.**

### Image-to-Video-Keyframe-Semantik

Die Reihenfolge in `image_urls` ist semantisch — nicht sortieren oder deduplizieren:

| Anzahl | Bedeutung                                                                                         |
| ------ | ------------------------------------------------------------------------------------------------- |
| 1      | **Startframe**                                                                                    |
| 2      | Erster Start, zweiter **Endframe**                                                                |
| 3\~10  | Erster Start, letzter Ende, mittlere Frames **gleichmäßig verteilt** (`duration` explizit setzen) |

## Anfrageparameter

<ParamField body="model" type="string" required>
  Fester Wert: `flux-3-video`
</ParamField>

<ParamField body="prompt" type="string" required>
  Prompt. **Darf nicht gesendet werden**, wenn `draft_from_task_id` verwendet wird (wird abgelehnt).
</ParamField>

<ParamField body="duration" type="integer" default="5">
  Dauer in Sekunden, Ganzzahl **5\~20**, Standard `5`

  <Warning>
    **`duration: "auto"` wird nicht unterstützt** (Abrechnung braucht eine feste Sekundenzahl). Weglassen, `"auto"` oder Nicht-Ganzzahlen → als **5 Sekunden** behandelt, ohne Fehler und ohne adaptive Länge.
  </Warning>

  <Note>
    Bei **Videofortsetzung** kann die gelieferte Dauer kürzer sein als angefordert (z. B. Anfrage 5 s, Ergebnis 4 s). Die angeforderten Sekunden werden vorab belastet und die Differenz nach Abschluss erstattet; Endbetrag ist Query-`cost`. Text/Image-to-Video zeigen diese Lücke nicht.
  </Note>
</ParamField>

<ParamField body="resolution" type="string" default="hd">
  Auflösung

  * `hd` (Standard; akzeptiert auch `720p`)
  * `fhd` (akzeptiert auch `1080p`)

  Gemessen: `hd` \~1280×704 bei 16:9; `fhd` \~1920×1088.

  <Warning>
    Draft-Modus (`draft:true`) erlaubt **nur** `hd`.
  </Warning>
</ParamField>

<ParamField body="aspect_ratio" type="string" default="auto">
  Seitenverhältnis

  Optionen: `21:9`, `2:1`, `16:9`, `4:3`, `1:1`, `3:4`, `9:16` oder `auto` (Standard; wird aus Prompt und Assets automatisch gewählt)
</ParamField>

<ParamField body="image_urls" type="string[]">
  Image-to-Video-Keyframes, **1\~10**, öffentliche http(s)-URL oder Base64
</ParamField>

<ParamField body="video_url" type="string">
  Eingabevideo für Fortsetzung (mp4, öffentliche URL oder Base64)
</ParamField>

<ParamField body="video_urls" type="string[]">
  Wie `video_url`; verwendet das **erste** Element (Kompatibilität)
</ParamField>

<ParamField body="audio" type="boolean" default="true">
  Synchrones Audio erzeugen, Standard `true`. `false` ergibt stummes Video (**kein Rabatt**)
</ParamField>

<ParamField body="draft" type="boolean" default="false">
  Draft-Modus: \~**1/3 Preis** niedrige Vorschauqualität; nur mit `resolution: hd`
</ParamField>

<ParamField body="draft_from_task_id" type="string">
  Draft → Final: ID **Ihrer** erfolgreichen Draft-Aufgabe

  * Nur `resolution` darf geändert werden; Prompt, Dauer, Bilder, Video nicht
  * Zum vollen Finalpreis abgerechnet; Draft-Gebühr wird nicht angerechnet
  * Gegenseitig ausschließend mit `draft:true`
</ParamField>

<ParamField body="safety_tolerance" type="integer" default="2">
  Moderations-Toleranz **0\~4**, Standard `2` (höher = permissiver)

  <Note>
    Nicht mit FLUX.2-Bildern (0~~5) oder Kontext (0~~6) verwechseln.
  </Note>
</ParamField>

<ParamField body="mode" type="string">
  Expliziter Modus (optional); siehe Generierungsmodi
</ParamField>

## Draft-Modus

Zweistufiger Workflow, wenn Iteration teuer ist:

```
Step 1  draft:true            → ~1/3 Preis niedrige Vorschauqualität
Step 2  draft_from_task_id    → Final zum vollen Preis mit Draft-Look
```

### Draft erstellen

```json theme={null}
{
  "model": "flux-3-video",
  "prompt": "An orange cat jumps onto a sunlit wooden table",
  "duration": 5,
  "draft": true
}
```

### Draft zu Final

```json theme={null}
{
  "model": "flux-3-video",
  "draft_from_task_id": "task_01K_DRAFT...",
  "resolution": "fhd"
}
```

Beim Übergang vom Draft zum Final wird in voller Qualität mit den gespeicherten Draft-Parametern (Modus / Prompt / Seed / Assets) gerendert. Fortsetzungs-Drafts finalisieren zu Fortsetzungs-Finalpreisen.

## Anfragebeispiele

### Text-to-Video (Hochformat)

```json theme={null}
{
  "model": "flux-3-video",
  "prompt": "Rainy Tokyo street at night, neon in puddles, a person walks with an umbrella.",
  "duration": 8,
  "resolution": "fhd",
  "aspect_ratio": "9:16"
}
```

### Image-to-Video (Start + Endframe)

```json theme={null}
{
  "model": "flux-3-video",
  "prompt": "Slow push-in as a flower opens from bud to bloom",
  "image_urls": [
    "https://example.com/bud.jpg",
    "https://example.com/bloom.jpg"
  ],
  "duration": 5
}
```

### Videofortsetzung

```json theme={null}
{
  "model": "flux-3-video",
  "prompt": "Camera keeps following as the lead turns toward a distant lighthouse",
  "video_url": "https://example.com/clip.mp4",
  "duration": 5
}
```

### Stummes Video

```json theme={null}
{
  "model": "flux-3-video",
  "prompt": "...",
  "audio": false
}
```

## Einschränkungen

| Limit              | Wert                                                           |
| ------------------ | -------------------------------------------------------------- |
| Dauer              | Ganzzahl 5\~20 (`auto` nicht unterstützt; `21` wird abgelehnt) |
| Keyframes          | 1\~10                                                          |
| Auflösung          | nur `hd` / `fhd`; Draft nur `hd`                               |
| Seitenverhältnis   | Sieben Optionen oder `auto`                                    |
| `safety_tolerance` | 0\~4                                                           |

### Häufige Submit-Fehler (meist nicht berechnet)

| Fall                                                     | Hinweise                                   |
| -------------------------------------------------------- | ------------------------------------------ |
| Fehlendes `prompt`                                       | Erforderlich außer bei Draft-Finalisierung |
| Ungültige `resolution` / `aspect_ratio` / `duration`     | Außerhalb des Bereichs                     |
| Keyframes > 10                                           | Obergrenze überschritten                   |
| Explizites `i2v` ohne Bilder / `v2v` ohne Video          | Modus/Asset-Mismatch                       |
| `draft:true` + `fhd`                                     | Draft nur hd                               |
| Ungültige / Nicht-Draft / unfertige `draft_from_task_id` | Finalisierungs-Vorbedingungen              |
| Prompt / Dauer bei Finalisierung ändern                  | Nur `resolution` erlaubt                   |
| Sowohl `draft` als auch `draft_from_task_id`             | Gegenseitig ausschließend                  |

Moderationsfehler enden als `failed` mit **voller Rückerstattung**.

## Funktionsabdeckung

| Fähigkeit                                   | Status                                         |
| ------------------------------------------- | ---------------------------------------------- |
| t2v / i2v / v2v                             | ✅ Auto oder explizites `mode`                  |
| Draft / Draft-Finalisierung                 | ✅ `draft` / `draft_from_task_id`               |
| Synchrones Audio                            | ✅ Standard an; `audio:false` aus (kein Rabatt) |
| Zeitgesteuerte Keyframes `[Sekunden, Bild]` | ❌ Nur gleichmäßig verteiltes Keyframe-Array    |
| `duration: "auto"`                          | ❌ Nicht unterstützt                            |

## Response

<ResponseField name="code" type="integer">
  Statuscode; 200 bei Erfolg
</ResponseField>

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

  <Expandable title="Array-Elemente">
    <ResponseField name="status" type="string">
      Task-Status; bei Erstellung `submitted`
    </ResponseField>

    <ResponseField name="task_id" type="string">
      Task-ID zum Abfragen
    </ResponseField>
  </Expandable>
</ResponseField>

<Note>
  **Ergebnisse abfragen**

  Die Videogenerierung ist asynchron. Abfragen Sie [Aufgabenstatus abrufen](/de/api-reference/tasks/status).

  Empfohlenes Intervall **5\~10 Sekunden**; Client-Timeout **15 Minuten** (20 s fhd ist langsamer). Gemessen \~60 s für `t2v` + `hd` + 5 s.

  Bei Erfolg `result.videos[0].url` verwenden; Assets werden auf das Plattform-CDN gespiegelt. `cost` ist der Endbetrag. Bei Fehlern volle Rückerstattung.
</Note>
