Commit Graph

6 Commits

Author SHA1 Message Date
valknar 4cd88ba477 fix: skip aspect_ratio for kling-o1 models and detect image MIME via Pillow
kling-o1-pro and kling-o1-std silently fail when aspect_ratio is included
in the payload — they derive it from the input image. Added
VIDEO_ASPECT_RATIO_MODELS whitelist so only kling-elements and minimax-hailuo
receive the parameter.

Also switched image_to_base64 to use Pillow for format detection instead of
trusting the file extension, which correctly handles files saved with the
wrong extension.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 18:50:41 +02:00
valknar 0de3f7d6bc fix: correct per-model video API field names and remove non-existent models
Each video model uses a different image input field:
- kling-o1-pro/std: first_frame (not image)
- kling-elements-pro/std: images (array)
- minimax-hailuo: image, duration fixed at "6"

Also:
- kling-elements requires slug aspect ratios (square_1_1, etc.)
- Remove wan-2.5 and runway-gen4 which return 404

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 18:15:59 +02:00
valknar 209a4840db fix: send video duration as string, not integer
The Kling API expects duration as '5' or '10' (string), not an int.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 18:13:38 +02:00
valknar d0f454df29 fix: normalize aspect ratio per model, surface invalid_params in errors
Models like mystic, flux-pro-1.1, and seedream-v4/v4-5 require named
aspect ratio slugs (e.g. "square_1_1", "widescreen_16_9") while other
models accept the "W:H" format directly.

- Add normalize_aspect_ratio() mapping W:H strings to slugs for affected models
- Apply normalization in generate-image before building the request payload
- Improve FreepikAPIError to surface invalid_params field details from the API
  response, so "Validation error" now also shows which field failed and why

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 18:06:40 +02:00
valknar e6bf85ca8a docs: add comprehensive README and .claude to .gitignore
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 10:59:29 +02:00
valknar f24d138ab4 feat: initial Freepik AI CLI
Sophisticated Python CLI for generating and manipulating images and
video via the Freepik API, built with typer + rich.

Commands:
- generate-image: text-to-image with 8 models (flux-2-pro, mystic, seedream, etc.)
- generate-video: image-to-video with 7 models (kling, minimax, runway, etc.)
- generate-icon: text-to-icon in solid/outline/color/flat/sticker styles
- upscale-image: 3 modes (precision-v2, precision, creative) + 2x/4x scale
- upscale-video: standard/turbo modes
- expand-image: outpainting with per-side pixel offsets
- relight: AI-controlled relighting (Premium)
- style-transfer: artistic style application (Premium)
- describe-image: reverse-engineer an image into a prompt
- config set/get/show/reset: configuration management

Features: Rich Live polling panel, exponential backoff, --wait/--no-wait,
auto-timestamped output filenames, streaming download with progress bar,
FREEPIK_API_KEY env var support, venv-based setup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 10:56:45 +02:00