# GenKite API

Source: https://genkite.ai/api. REST, JSON, at `https://genkite.ai/api/v1`. Same models, prices, limits and refunds as the studio; renders are paid from the account's credits. Any account with a plan or credit pack can make keys in the studio under API keys.

## Authentication

Send `Authorization: Bearer gk_live_...` on every request. `GET /me` returns the account and its credit balance.

## Endpoints

| Method | Path | What it does |
|---|---|---|
| GET | /me | Account name, plan and credits |
| GET | /models | Every video and picture model: slug, modes, aspect_ratios, resolutions, durations, audio, from_credits, available |
| POST | /videos | Start a video. Fields: model, prompt (required); duration, aspect_ratio, resolution, audio, negative_prompt, seed; multipart image (first frame) and last_image. Answers 202 with the generation |
| POST | /images | Start pictures. Fields: model, prompt (required); aspect_ratio, resolution, count |
| GET | /generations/{id} | Status, progress, credits, and when completed video_url and thumbnail_url (or image_urls), signed for six hours |
| GET | /generations?limit=20&before={id} | Your renders, newest first |

Send an `Idempotency-Key` header so a retried POST returns the first render instead of charging twice. Status goes pending, queued, processing, completed (or failed, with credits refunded).

## Example

```
curl https://genkite.ai/api/v1/videos \
  -H "Authorization: Bearer $GENKITE_KEY" \
  -d model=kling-4 -d prompt="A paper kite over the sea at dawn" -d duration=5 -d aspect_ratio=16:9
```

## Errors and limits

401 missing or deleted key; 402 not enough credits (body has required and available); 422 invalid field (errors says which); 429 more than 60 requests a minute per key (see Retry-After). The plan's limit on renders running at once applies.
