# 이미지 업스케일

이미지를 2K, 4K 또는 8K로 업스케일합니다.

출처: https://scifig.ai/ko/docs/api/image-upscales

## JSON 본문

`POST /images/upscales`. 필요한 범위: `figures:generate`.

| 필드 | 유형 | 필수 | 기본값 | 규칙 |
| --- | --- | --- | --- | --- |
| image | string | 예 | — | 이미지 `file_id` |
| scale | string | 예 | — | `2k`, `4k`(Starter 이상) 또는 `8k`(Plus 이상). 크레딧 팩 잔액이 0보다 크면 Pro로 간주 |

| scale | 크레딧 |
| --- | --- |
| 2k | 50 |
| 4k | 100 |
| 8k | 150 |

이미 목표 크기에 도달한 이미지는 `details.reason = UPSCALE_ALREADY_AT_TARGET`가 포함된 `400 INVALID_REQUEST`를 반환하며 과금하지 않습니다. 생성된 과학 그림은 약 2K이므로 `4k` 또는 `8k`를 요청하세요. 시간이 초과된 업스케일은 환불되며, 나중에 결과가 제공되지 않습니다. 응답은 작업 객체입니다. 필드와 상태는 [작업 및 대기 시간 제한](/ko/docs/api/jobs)을, 오류는 [오류](/ko/docs/api/errors)를 참조하세요.

## cURL

```bash
curl -X POST https://scifig.ai/api/v1/images/upscales \
  -H "Authorization: Bearer $SCIFIG_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Prefer: wait=25" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "<file_id>",
    "scale": "4k"
  }'
```

## JavaScript

```javascript
const response = await fetch('https://scifig.ai/api/v1/images/upscales', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.SCIFIG_API_KEY}`,
    'Idempotency-Key': crypto.randomUUID(),
    Prefer: 'wait=25',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "image": "<file_id>",
    "scale": "4k"
  }),
});
const result = await response.json();
console.log(response.status, result);
```

## Python

```python
import os
import uuid

import requests

headers = {
    "Authorization": f"Bearer {os.environ['SCIFIG_API_KEY']}",
    "Idempotency-Key": str(uuid.uuid4()),
    "Prefer": "wait=25",
}
response = requests.post(
    "https://scifig.ai/api/v1/images/upscales",
    headers=headers,
    json={
        "image": "<file_id>",
        "scale": "4k"
    },
    timeout=60,
)
print(response.status_code, response.json())
```
