SciFig
無料で始める

API リファレンス

画像の高解像度化

画像を 2K、4K、8K に高解像度化します。

Markdown で表示

JSON 本文#

POST /images/upscales。必要なスコープ:figures:generate。

フィールド型必須既定値規則
imagestringはい—画像の file_id
scalestringはい—2k、4k(Starter 以上)、8k(Plus 以上)。クレジットパック残高が 0 を超える場合は Pro 相当
scaleクレジット
2k50
4k100
8k150

すでに目標サイズ以上の画像は、details.reason = UPSCALE_ALREADY_AT_TARGET 付きの 400 INVALID_REQUEST を返し、課金しません。生成した科学図表は約 2K のため、4k または 8k を指定してください。タイムアウトした高解像度化は返金され、後から納品されることはありません。レスポンスはジョブです。フィールドとステータスはジョブと待機時間の上限、エラーはエラーを参照してください。

cURL#

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#

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#

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())