SciFig
無料で始める

API リファレンス

画像生成

テキストプロンプトから科学図表を生成します。任意で参照画像も指定できます。

Markdown で表示

JSON 本文#

JSON 本文を伴う POST /images/generations。必要なスコープ:figures:generate。

フィールド型必須既定値規則
promptstringはい—3~20,000 文字
aspect_ratiostringいいえ1:11:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
qualitystringいいえstandardstandard、advanced、premium のいずれか。モデルと料金を設定
stylestringいいえ—flat, 2-5d, line-art, hand-drawn, scientific, line, 3d, editorial, sketch, watercolor, auto
palette文字列または配列いいえ—パレットのプリセット ID、または 1~4 色の #RRGGBB
reference_file_idsarrayいいえ—画像の file_id 1~3 個(アップロードまたは既存の出力)

未知のフィールドは 400 INVALID_REQUEST で拒否され、details.issues に各問題が示されます。一部のモデル、参照画像、縦横比には有料プランが必要で、未加入の場合は 403 PLAN_REQUIRED を返します。

クレジット#

qualityクレジット
standard50
advanced75
premium100

ジョブ作成時にクレジットを確保し、成功時に一度だけ課金し、失敗時には全額返還します。レスポンスはジョブです。フィールドとステータスはジョブと待機時間の上限、エラーはエラーを参照してください。

cURL#

curl -X POST https://scifig.ai/api/v1/images/generations \
  -H "Authorization: Bearer $SCIFIG_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Prefer: wait=25" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Schematic of CRISPR-Cas9 gene editing: guide RNA, Cas9, target DNA and the double-strand break, labelled",
    "aspect_ratio": "4:3",
    "quality": "standard"
  }'

JavaScript#

const response = await fetch('https://scifig.ai/api/v1/images/generations', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.SCIFIG_API_KEY}`,
    'Idempotency-Key': crypto.randomUUID(),
    Prefer: 'wait=25',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "prompt": "Schematic of CRISPR-Cas9 gene editing: guide RNA, Cas9, target DNA and the double-strand break, labelled",
    "aspect_ratio": "4:3",
    "quality": "standard"
  }),
});
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/generations",
    headers=headers,
    json={
        "prompt": "Schematic of CRISPR-Cas9 gene editing: guide RNA, Cas9, target DNA and the double-strand break, labelled",
        "aspect_ratio": "4:3",
        "quality": "standard"
    },
    timeout=60,
)
print(response.status_code, response.json())