# Video oluşturma

> İstemden, ilk kareden, son kareden ya da referans görsellerden bir video işi başlatın. İş nesnesi hemen döner.

`POST https://api.getlykia.com/v1/videos`

Bir video işi başlatır ve iş nesnesini `status: "queued"` ile hemen döndürür. İşi [`GET /videos/{id}`](https://www.getlykia.com/docs/api-reference/videos-get) ile izleyin, dosyayı [`GET /videos/{id}/content`](https://www.getlykia.com/docs/api-reference/videos-content) ile indirin. Adım adım anlatım: [Video üretimi](https://www.getlykia.com/docs/guides/video-generation).

## İstek gövdesi

- `model` (string, zorunlu) — Bir video modeli kimliği (örneğin `bytedance/seedance-1.0-pro`) ya da `@video` gibi bir hazır ayar. Video modellerini `GET /models?kind=video` listeler.
- `prompt` (string, zorunlu) — Videoda ne olacağı.
- `image` (string) — İlk kare: herkese açık `https://` adresi ya da data URI.
- `last_frame` (string) — Son kare; `image` ile birlikte, `lastFrame` destekleyen modellerde.
- `reference_images` (string\[]) — Modelin izin verdiği kadar, en çok 32 referans görsel.
- `duration` (number) — Saniye cinsinden uzunluk; modelin `durations` aralığında. `duration_seconds` ve `seconds` da okunur.
- `aspect_ratio` (string) — Modelin `aspectRatios` değerlerinden.
- `resolution` (string) — Modelin `resolutions` değerlerinden.
- `audio` (boolean) — Sesin seçilebildiği modellerde ses açık ya da kapalı.
- `seed` (integer) — Destekleyen modellerde.
- `provider_options` (object) — Modelin izin listesindeki sağlayıcıya özgü seçenekler.
- `models`, `provider`, `user`, `metadata` — [`POST /images/generations`](https://www.getlykia.com/docs/api-reference/images-generations) ile aynı.

## Örnek

**İstek**

cURL

```bash
curl https://api.getlykia.com/v1/videos \
  -H "Authorization: Bearer $LYKIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "bytedance/seedance-1.0-pro",
    "prompt": "Waves rolling onto a quiet beach at dusk, slow camera pan",
    "duration": 5,
    "resolution": "720p",
    "aspect_ratio": "16:9"
  }'
```

Python

```python
import os

import requests

response = requests.post(
    "https://api.getlykia.com/v1/videos",
    headers={"Authorization": f"Bearer {os.environ['LYKIA_API_KEY']}"},
    json={
        "model": "bytedance/seedance-1.0-pro",
        "prompt": "Waves rolling onto a quiet beach at dusk, slow camera pan",
        "duration": 5,
        "resolution": "720p",
        "aspect_ratio": "16:9",
    },
    timeout=60,
)
response.raise_for_status()
job = response.json()
print(job["id"], job["status"])  # keep the id: it is how you follow the job
```

TypeScript

```typescript
const response = await fetch("https://api.getlykia.com/v1/videos", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.LYKIA_API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    model: "bytedance/seedance-1.0-pro",
    prompt: "Waves rolling onto a quiet beach at dusk, slow camera pan",
    duration: 5,
    resolution: "720p",
    aspect_ratio: "16:9",
  }),
});
if (!response.ok) throw new Error(`Lykia returned ${response.status}: ${await response.text()}`);

const job = (await response.json()) as { id: string; status: string };
console.log(job.id, job.status); // keep the id: it is how you follow the job
```

**Yanıt (200)**

```json
{
    "id": "gen-1795463406-qOWSYdRnX7cEsv8q",
    "object": "video",
    "status": "queued",
    "progress": 0,
    "model": "bytedance/seedance-1.0-pro",
    "provider": "bytedance",
    "created_at": 1795463406,
    "completed_at": null,
    "expires_at": null,
    "duration_seconds": null,
    "params": {
        "duration": 5,
        "aspect_ratio": "16:9",
        "resolution": "720p",
        "image": false,
        "last_frame": false,
        "reference_images": 0
    }
}
```

İş nesnesi [`GET /videos/{id}`](https://www.getlykia.com/docs/api-reference/videos-get) altında anlatılır. `params` isteğinizin özetidir; görsel girdiler yalnız verilip verilmediğini gösterir.

## Hatalar

| Durum | Kod                       | Ne zaman                                                                                    |
| ----- | ------------------------- | ------------------------------------------------------------------------------------------- |
| `400` | `unsupported_input`       | Desteklenmeyen bir değer (`metadata.param`) ya da henüz fiyatlanmamış bir seçenek bileşimi. |
| `400` | `unsupported_model`       | Model video üretmiyor.                                                                      |
| `402` | `insufficient_credits`    | Bakiye, anahtar limiti ya da proje bütçesi işin ayırmasını karşılamıyor.                    |
| `403` | `platform_sales_disabled` | Sağlayıcı henüz Lykia kredisiyle sunulmuyor; o sağlayıcı için kendi anahtarınızı ekleyin.   |
| `403` | `byok_only_no_key`        | Proje yalnız kendi sağlayıcı anahtarlarına izin veriyor ve bu model için anahtarı yok.      |
| `429` | `media_queue_full`        | Projenin Lykia'da bekletebileceği iş sayısı dolu.                                           |

Örneğin modelin aralığı dışında bir süre:

```json
{
    "error": {
        "message": "duration must be between 2 and 12 seconds for seedance-1-0-pro-250528",
        "type": "invalid_request_error",
        "code": "unsupported_input",
        "status": 400,
        "metadata": {
            "reason": "unsupported_input",
            "param": "duration"
        }
    }
}
```
