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