メインコンテンツへスキップ

概要

Krea では、企業向けに Zero Data Retention を有効にできます。現在、公開 API では Krea 2 Medium、Krea 2 Large、Krea 2 Medium Turbo がサポートされています。ワークスペースで有効化するには sales@krea.ai ↗ までお問い合わせください。サポートが有効化されたら、次のようにリクエストを送信します。
curl -X POST https://api.krea.ai/generate/image/krea/krea-2/medium \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -H "X-Api-Zero-Data-Retention: 1" \
  -d '{
    "prompt": "a serene mountain landscape at sunset",
    "aspect_ratio": "1:1",
    "resolution": "1K"
  }'
提供される URL(たとえばスタイル参照画像など)は、すべて base64 のデータ URI である必要があります。外部 URL を使用すると 422Zero data retention requires external asset inputs to be data URIs. が返されます。
STYLE_REF_DATA_URI="data:image/png;base64,$(base64 < ./style-reference.png | tr -d '\n')"

curl -X POST https://api.krea.ai/generate/image/krea/krea-2/medium \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -H "X-Api-Zero-Data-Retention: 1" \
  -d '{
    "prompt": "a serene mountain landscape at sunset",
    "aspect_ratio": "1:1",
    "resolution": "1K",
    "image_style_references": [
      {
        "url": "'"$STYLE_REF_DATA_URI"'",
        "strength": 0.6
      }
    ]
  }'