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

# cURL

> Use Kyma API directly from the terminal.

## Basic request

```bash theme={null}
curl https://kymaapi.com/v1/chat/completions \
  -H "Authorization: Bearer ky-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-3.6-plus",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
```

## With system prompt

```bash theme={null}
curl https://kymaapi.com/v1/chat/completions \
  -H "Authorization: Bearer ky-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-3.6-plus",
    "messages": [
      {"role": "system", "content": "You are a pirate."},
      {"role": "user", "content": "Tell me about the weather."}
    ]
  }'
```

## Streaming

```bash theme={null}
curl https://kymaapi.com/v1/chat/completions \
  -H "Authorization: Bearer ky-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-3.6-plus",
    "messages": [{"role": "user", "content": "Write a poem"}],
    "stream": true
  }'
```

## List models

```bash theme={null}
curl https://kymaapi.com/v1/models
```

## Check rate limits

```bash theme={null}
curl https://kymaapi.com/v1/auth/limits \
  -H "Authorization: Bearer ky-your-api-key"
```

## Generating images and videos

Image and video models use a separate async endpoint. POST to `/v1/images/generations` or `/v1/videos/generations`, get a `job_id` back, poll `/v1/jobs/{id}` until status is `succeeded`.

```bash theme={null}
JOB=$(curl -sS -X POST https://kymaapi.com/v1/videos/generations \
  -H "Authorization: Bearer ky-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"model":"kling-3-pro","prompt":"A drone shot over a misty mountain range at sunrise","duration":5}' \
  | jq -r '.id')

# Poll every 3s until done
while true; do
  RESP=$(curl -sS https://kymaapi.com/v1/jobs/$JOB \
    -H "Authorization: Bearer ky-your-api-key")
  STATUS=$(echo "$RESP" | jq -r '.status')
  [ "$STATUS" = "succeeded" ] && break
  case "$STATUS" in failed|expired|refunded) echo "$RESP"; exit 1;; esac
  sleep 3
done

echo "$RESP" | jq -r '.output.url'
```

Same pattern for `/v1/images/generations`: swap the model (`flux-1.1-ultra`, `ideogram-v3`, `recraft-v3`, `flux-kontext-pro`) and omit `duration`.
