# Hızlı başlangıç

> İlk görselinizi oluşturup bir dosyaya kaydedin: oturum açın, bir anahtar oluşturun, bir görev gönderin, durumunu sorgulayın ve sonucu indirin.

Bu sayfanın sonunda, tek bir API çağrısıyla oluşturulmuş bir PNG dosyası diskinizde olacak. Bunun için bir e-posta adresine, sıfırın üzerinde bir bakiyeye ve [`jq`](https://jqlang.org) ile birlikte `curl` aracına (veya `requests` ile Python 3'e ya da Node.js 18+'ya) ihtiyacınız var. Hesabınızda bakiye varsa bu işlem yaklaşık iki dakika sürer.

Bu sayfalar, bir grup model için tek bir isteği adım adım anlatır: [Seedance API](https://kerox.ai/tr/seedance-api), [Kling API](https://kerox.ai/tr/kling-api), [yapay zeka resim oluşturma API'si](https://kerox.ai/tr/ai-image-generator-api), [metinden videoya API](https://kerox.ai/tr/text-to-video-api) ve [görselden videoya API](https://kerox.ai/tr/image-to-video-api).

<a id="key"></a>

## Anahtar edinin ve bakiye yükleyin
1. Size e-postayla gönderdiğimiz 6 haneli kodla [Konsol](https://kerox.ai/tr/console/api-keys)'a giriş yapın. İlk girişinizde hesabınız oluşturulur.
2. **API** → **API anahtarları** bölümünü açın ve bir API anahtarı oluşturun. Anahtarın tamamı yalnızca bir kez, oluşturduğunuz anda gösterilir. Bu nedenle anahtarı o anda kopyalayın.
3. **Cüzdan** bölümünü açın ve kullanılabilir bakiyeyi kontrol edin. Bakiye eklemek için aynı bölümden kart veya Alipay ile yükleme yapın: [Bakiye yüklemeleri](https://kerox.ai/tr/docs/pricing-billing.md#topups). Bakiye bir görevin tahmini maliyetini karşılayamadığında görev HTTP `402` ile reddedilir.

API anahtarını bir ortam değişkenine kaydedin. Her istek anahtarı `Authorization: Bearer <your-api-key>` olarak gönderir. Anahtarı her zaman sunucunuzda tutun, hiçbir zaman bir tarayıcı uygulamasına koymayın. Anahtar yenileme ve isteğe bağlı limitler: [API anahtarları](https://kerox.ai/tr/docs/authentication.md).


```bash
export KEROX_API_KEY="kx_live_your_api_key_here"
```


<a id="submit"></a>

## Gönderin, sorgulayın, indirin
Tek bir betik tüm süreci yürütür. `POST /v1/tasks`, görevin `id` ve `status: "processing"` değerleriyle HTTP `201` döndürür. Betik, `status` değeri `succeeded` veya `failed` olana kadar `GET /v1/tasks/{id}` adresini 3 saniyede bir sorgular, ardından dosyayı kaydeder ya da başarısızlık nedenini yazdırır. İstemci 10 dakika sonra beklemeyi bırakır. Bu durumda yazdırılan görev kimliğini saklayın ve görevi daha sonra yeniden sorgulayın. Sunucu tarafındaki bir zaman aşımı, `error.code: "timeout"` ile birlikte `failed` olarak görünür. Yeni bir görevi yalnızca başarısızlık doğrulandıktan sonra gönderin ([Zaman aşımları](https://kerox.ai/tr/docs/tasks.md#retention)).


```bash
# Needs curl and jq. KEROX_API_KEY is your key.
set -euo pipefail
API=https://api.kerox.ai/v1
AUTH="Authorization: Bearer $KEROX_API_KEY"
BODY='{
  "model": "bytedance/seedream-5.5",
  "input": {
    "prompt": "editorial portrait of a ceramicist in morning sunlight, 35mm film",
    "resolution": "2K"
  }
}'

# 1. Submit: HTTP 201 with the task's id.
TASK_ID=$(curl -sS --fail-with-body -X POST "$API/tasks" \
  -H "$AUTH" -H "Content-Type: application/json" -d "$BODY" | jq -r .id)
echo "Submitted $TASK_ID"

# 2. Poll every 3 seconds, for up to 10 minutes.
DEADLINE=$(( $(date +%s) + 600 ))
STATUS=processing
while [ "$STATUS" = "processing" ] && [ "$(date +%s)" -lt "$DEADLINE" ]; do
  sleep 3
  REM=$(( DEADLINE - $(date +%s) ))
  [ "$REM" -le 0 ] && break
  [ "$REM" -gt 30 ] && REM=30
  TASK=$(curl -sS --fail-with-body --max-time "$REM" "$API/tasks/$TASK_ID" -H "$AUTH")
  STATUS=$(echo "$TASK" | jq -r .status)
done

# 3. Save the file, or show why it failed.
if [ "$STATUS" = "processing" ]; then
  echo "Still running: TASK_ID=$TASK_ID, read it later with GET /v1/tasks/{id}"
  exit 1
elif [ "$STATUS" != "succeeded" ]; then
  echo "Task $TASK_ID is $STATUS: $(echo "$TASK" | jq -c .error)"
  exit 1
fi
curl -sS --fail-with-body -o result.png "$(echo "$TASK" | jq -r '.outputs[0].url')"
echo "Saved result.png"
```
```python
# pip install requests
import os
import time
import requests

API = "https://api.kerox.ai/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['KEROX_API_KEY']}"}

# 1. Submit: HTTP 201 with the task's id.
resp = requests.post(
    f"{API}/tasks",
    headers=HEADERS,
    json={
        "model": "bytedance/seedream-5.5",
        "input": {
            "prompt": "editorial portrait of a ceramicist in morning sunlight, 35mm film",
            "resolution": "2K",
        },
    },
    timeout=60,
)
if resp.status_code != 201:
    raise SystemExit(f"HTTP {resp.status_code}: {resp.json()['error']}")
task = resp.json()
print("Submitted", task["id"])

# 2. Poll every 3 seconds, for up to 10 minutes.
deadline = time.time() + 600
while task["status"] == "processing" and time.time() < deadline:
    time.sleep(3)
    remaining = max(1, min(30, deadline - time.time()))
    poll = requests.get(f"{API}/tasks/{task['id']}", headers=HEADERS, timeout=remaining)
    poll.raise_for_status()
    task = poll.json()

# 3. Save the file, or show why it failed.
if task["status"] == "processing":
    raise SystemExit(f"Still running: task {task['id']}, read it again later")
if task["status"] != "succeeded":
    raise SystemExit(f"Task {task['id']} is {task['status']}: {task['error']}")
file = requests.get(task["outputs"][0]["url"], timeout=60)
file.raise_for_status()
with open("result.png", "wb") as fh:
    fh.write(file.content)
print("Saved result.png")
```
```javascript
// Node.js 18 or later: fetch is built in.
import fs from 'node:fs/promises';

const API = 'https://api.kerox.ai/v1';
const headers = { Authorization: `Bearer ${process.env.KEROX_API_KEY}` };

// 1. Submit: HTTP 201 with the task's id.
const res = await fetch(`${API}/tasks`, {
  method: 'POST',
  headers: { ...headers, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    model: 'bytedance/seedream-5.5',
    input: {
      prompt: 'editorial portrait of a ceramicist in morning sunlight, 35mm film',
      resolution: '2K',
    },
  }),
});
let task = await res.json();
if (res.status !== 201) throw new Error(`HTTP ${res.status}: ${task.error.message}`);
console.log('Submitted', task.id);

// 2. Poll every 3 seconds, for up to 10 minutes.
const deadline = Date.now() + 10 * 60 * 1000;
while (task.status === 'processing' && Date.now() < deadline) {
  await new Promise((resolve) => setTimeout(resolve, 3000));
  const poll = await fetch(`${API}/tasks/${task.id}`, {
    headers,
    signal: AbortSignal.timeout(Math.max(1000, Math.min(30_000, deadline - Date.now()))),
  });
  if (!poll.ok) throw new Error(`HTTP ${poll.status}`);
  task = await poll.json();
}

// 3. Save the file, or show why it failed.
if (task.status === 'processing') {
  throw new Error(`Still running: task ${task.id}, read it later with GET /v1/tasks/{id}`);
}
if (task.status !== 'succeeded') {
  throw new Error(`Task ${task.id} is ${task.status}: ${JSON.stringify(task.error)}`);
}
const file = await fetch(task.outputs[0].url);
if (!file.ok) throw new Error(`Download failed: HTTP ${file.status}`);
await fs.writeFile('result.png', Buffer.from(await file.arrayBuffer()));
console.log('Saved result.png');
```


Gönderim isteği `201` dışında bir yanıt döndürürse yanıt gövdesi bir hata nesnesidir. Her kodun ne anlama geldiğini ve ne yapmanız gerektiğini [Hatalar](https://kerox.ai/tr/docs/errors.md#next-steps) sayfasında bulabilirsiniz.

> **Çıktıyı 7 gün içinde kaydedin**
>
> Oluşturulan dosyalar, görev tamamlandıktan 7 gün sonra kullanılamaz hâle gelir (`expires_at`). İhtiyacınız olan dosyaları kendi depolama alanınızda saklayın ([Saklama süresi](https://kerox.ai/tr/docs/tasks.md#retention)).

<a id="webhook"></a>

### Sorgulama yapmak istemiyor musunuz? `webhook_url` gönderin
Aşağıdaki varsayılan istek sorgulama yöntemini kullanır. Geri çağrı almak için gönderim sırasında herkese açık kendi HTTPS alıcınızı belirtin. Teslimat gecikirse görevi sorgulayabilmek için görev kimliğini saklayın. Ayrıntılar için [Webhook'lar](https://kerox.ai/tr/docs/webhooks.md) sayfasına bakın.


```json
{
  "model": "bytedance/seedream-5.5",
  "input": {
    "prompt": "editorial portrait of a ceramicist in morning sunlight, 35mm film",
    "resolution": "2K"
  }
}
```


<a id="result"></a>

## Sonucu okuyun
Betiğin sonunda okuduğu görev aşağıdaki gibi görünür. `succeeded` durumunda dosyalar `outputs` içinde yer alır. Her dosya için bir öğe bulunur ve her öğenin kendi `type` ve `url` değeri vardır. `cost`, USD cinsinden kesinleşen tutardır (fiyatlar: [Modeller](https://kerox.ai/tr/docs/models.md)). `failed` durumunda başarısızlık nedeni `error` içinde yer alır ve bloke edilen tutar iade edilir. `input`, isteğinizin dönüştürüldüğü modele özgü parametreleri gösterir (bu örnekte `resolution`, `size` değerine dönüştürülmüştür). Tüm alanlar için: [Görev nesnesi](https://kerox.ai/tr/docs/tasks.md#submit-response).


```json
{
  "id": "task_01JD8X9B4Q2M7T8N3K5P6R1S0V",
  "object": "task",
  "model": "bytedance/seedream-5.5",
  "status": "succeeded",
  "source": "api",
  "format": "unified",
  "input": {
    "prompt": "editorial portrait of a ceramicist in morning sunlight, 35mm film",
    "size": "2K"
  },
  "outputs": [
    {
      "type": "image",
      "url": "https://cdn.kerox.ai/t/task_01JD8X9B4Q2M7T8N3K5P6R1S0V/5f2b8c1e9d3a4f6b8a7c0d1e2f3a4b5c/0.png",
      "content_type": "image/png",
      "width": 2048,
      "height": 2048
    }
  ],
  "outputs_deleted": false,
  "error": null,
  "cost": {
    "amount": "0.0280",
    "currency": "USD",
    "status": "settled"
  },
  "metadata": null,
  "warnings": [],
  "created_at": "2026-11-20T08:01:02Z",
  "started_at": "2026-11-20T08:01:02Z",
  "completed_at": "2026-11-20T08:01:10Z",
  "expires_at": "2026-11-27T08:01:10Z"
}
```


<a id="next"></a>

## Sonraki adımlar
- [Webhook'lar](https://kerox.ai/tr/docs/webhooks.md): Görev tamamlandığında sunucunuza otomatik olarak gönderilsin.
- [Dosyalar ve girdiler](https://kerox.ai/tr/docs/files.md): Bir referans görsel yükleyin ve bir görevde kullanın.
- [MCP sunucusu](https://kerox.ai/tr/docs/mcp.md): Claude Code veya Cursor üzerinden Kerox'u çağırın.
