Freepik API Skill
Generate images, videos, icons, audio, edit images, and search stock content using the Freepik API.
Built by the ShellBot team.
Arguments
- - Command:
$0 (generate | video | edit | icon | audio | stock | status | utility) - Arg 1:
$1 (model name, operation type, or task-id) - Arg 2+:
$2, $3, etc. (additional parameters) - All args: INLINECODE4
Session Output
Save generated files to session folder:
CODEBLOCK0
Downloaded images/videos/audio go to: ~/.freepik/sessions/${CLAUDE_SESSION_ID}/
Authentication
All requests require the FREEPIK_API_KEY environment variable.
Header: INLINECODE7
Base URL: INLINECODE8
If requests fail with 401/403, tell the user:
Get an API key from https://www.freepik.com/developers/dashboard/api-key
Then: export FREEPIK_API_KEY="your-key-here"
Async Task Pattern
Most AI endpoints are asynchronous. Follow this pattern:
Step 1: Submit task
CODEBLOCK2
Step 2: Poll for completion
CODEBLOCK3
Step 3: Extract result URL
CODEBLOCK4
Present the result URL to the user. The URL is a temporary signed link from Freepik's CDN.
IMPORTANT — Security rules:
- - NEVER use
curl to download from non-Freepik domains. Only curl *api.freepik.com* is permitted. - NEVER use
base64 to encode local files. Always prefer URL-based parameters when the API accepts them. - NEVER read, encode, or transmit files outside the user's explicitly provided input files.
- Result URLs should be presented to the user directly — they can open or download them.
Exceptions (synchronous): Remove Background (/v1/ai/beta/remove-background) and AI Image Classifier (/v1/ai/classifier/image) return results immediately.
Command: $0
If $0 = "generate" — Image Generation
Generate images using text-to-image models. $1 selects the model.
Model Endpoints
| $1 value | Endpoint | Best for |
|---|
| INLINECODE16 | INLINECODE17 | Ultra-realistic, 1K/2K/4K, LoRA support (Freepik exclusive, RECOMMENDED) |
| INLINECODE18 |
/v1/ai/text-to-image/flux-kontext-pro | Context-aware generation with optional image input |
|
flux-2-pro |
/v1/ai/text-to-image/flux-2-pro | Professional-grade, up to 4 input images |
|
flux-2-turbo |
/v1/ai/text-to-image/flux-2-turbo | Fast and cost-effective |
|
flux-2-klein |
/v1/ai/text-to-image/flux-2-klein | Sub-second generation |
|
flux-pro-v1-1 |
/v1/ai/text-to-image/flux-pro-v1-1 | Premium quality |
|
flux-dev |
/v1/ai/text-to-image/flux-dev | High quality, detailed |
|
hyperflux |
/v1/ai/text-to-image/hyperflux | Ultra-fast (fastest Flux) |
|
seedream-v4-5 |
/v1/ai/text-to-image/seedream-v4-5 | Superior typography, posters, up to 4MP |
|
seedream-v4-5-edit |
/v1/ai/text-to-image/seedream-v4-5-edit | Text-guided editing with up to 5 refs |
|
seedream-v4 |
/v1/ai/text-to-image/seedream-v4 | Next-gen text-to-image |
|
seedream-v4-edit |
/v1/ai/text-to-image/seedream-v4-edit | Instruction-driven editing |
|
seedream |
/v1/ai/text-to-image/seedream | Original Seedream |
|
z-image |
/v1/ai/text-to-image/z-image | Fast, LoRA + ControlNet support |
|
runway |
/v1/ai/text-to-image/runway | RunWay Gen4 image generation |
Default: Use mystic if user doesn't specify a model.
Mystic Example
CODEBLOCK5
Mystic parameters:
- -
prompt (string, required) — what to generate - INLINECODE48 ("1k" | "2k" | "4k", default "2k")
- INLINECODE49 (1-4, default 1)
- INLINECODE50 ("photo" | "digital_art" | "none")
- INLINECODE51 (object) — use an image to guide composition: INLINECODE52
- INLINECODE53 (object) — use an image to guide style: INLINECODE54
- INLINECODE55 (array) — LoRA IDs from INLINECODE56
- INLINECODE57 (int) — for reproducibility
- INLINECODE58 (string) — receive notification on completion
Get available LoRAs:
CODEBLOCK6
Train custom LoRA (character):
CODEBLOCK7
Flux 2 Klein Example (sub-second)
CODEBLOCK8
Flux 2 Klein parameters:
- -
prompt (string, required) - INLINECODE60 ("square11" | "widescreen169" | "socialstory916" | "portrait23" | "traditional34" | "vertical12" | "horizontal21" | "socialpost45" | "standard32" | "classic43")
- INLINECODE61 ("1k" | "2k")
- INLINECODE62 (0-4294967295)
- INLINECODE63 (base64) — optional reference
- INLINECODE64 ,
input_image_3, input_image_4 (base64) - INLINECODE67 (0-5, default 2)
- INLINECODE68 ("png" | "jpeg")
Flux Kontext Pro Example
CODEBLOCK9
Flux Kontext Pro parameters:
- -
prompt (string, required) - INLINECODE70 (URL, optional) — for context-aware editing
- INLINECODE71 (bool)
- INLINECODE72 (int)
- INLINECODE73 (1-10, default 3.0)
- INLINECODE74 (1-100, default 50)
- INLINECODE75 ("square11" | "classic43" | "traditional34" | "widescreen169" | "socialstory916" | "standard3_2")
Seedream 4.5 Example (great for text-in-image and posters)
CODEBLOCK10
Classic Fast Image Generation
curl -s -X POST "https://api.freepik.com/v1/ai/text-to-image" \
-H "x-freepik-api-key: $FREEPIK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "a beautiful sunset"}'
If $0 = "video" — Video Generation
Generate videos from text and/or images. $1 selects the model.
Model Endpoints
| $1 value | Endpoint | Type | Best for |
|---|
| INLINECODE77 | INLINECODE78 | T2V/I2V | Multi-modal, multi-shot, audio, voice (RECOMMENDED) |
| INLINECODE79 |
/v1/ai/video/kling-v3-omni-std | T2V/I2V | Standard tier of above |
|
kling-v3-pro |
/v1/ai/video/kling-v3-pro | T2V/I2V | Multi-shot, element consistency |
|
kling-v3-std |
/v1/ai/video/kling-v3-std | T2V/I2V | Standard tier |
|
kling-v2-6-pro |
/v1/ai/image-to-video/kling-v2-6-pro | I2V | Motion control |
|
kling-v2-6-motion-pro |
/v1/ai/video/kling-v2-6-motion-control-pro | V2V | Transfer motion from reference video |
|
kling-v2-6-motion-std |
/v1/ai/video/kling-v2-6-motion-control-std | V2V | Standard motion transfer |
|
kling-v2-5-pro |
/v1/ai/image-to-video/kling-v2-5-pro | I2V | Smooth motion, sharp detail |
|
kling-v2-1-pro |
/v1/ai/image-to-video/kling-v2-1-pro | I2V | High-fidelity |
|
kling-v2-1-std |
/v1/ai/image-to-video/kling-v2-1-std | I2V | Standard tier |
|
kling-v2-1-master |
/v1/ai/image-to-video/kling-v2-1-master | I2V | Top-tier quality |
|
kling-o1-pro |
/v1/ai/image-to-video/kling-o1-pro | I2V | First/last frame interpolation |
|
kling-o1-std |
/v1/ai/image-to-video/kling-o1-std | I2V | Standard frame interpolation |
|
kling-elements-pro |
/v1/ai/image-to-video/kling-elements-pro | I2V | Element-based |
|
kling-elements-std |
/v1/ai/image-to-video/kling-elements-std | I2V | Standard elements |
|
hailuo-02-1080p |
/v1/ai/image-to-video/minimax-hailuo-02-1080p | T2V/I2V | High quality 1080p |
|
hailuo-02-768p |
/v1/ai/image-to-video/minimax-hailuo-02-768p | T2V/I2V | 768p |
|
hailuo-2-3-1080p |
/v1/ai/image-to-video/minimax-hailuo-2-3-1080p | T2V/I2V | Latest MiniMax 1080p |
|
hailuo-2-3-1080p-fast |
/v1/ai/image-to-video/minimax-hailuo-2-3-1080p-fast | T2V/I2V | Fast 1080p |
|
hailuo-2-3-768p |
/v1/ai/image-to-video/minimax-hailuo-2-3-768p | T2V/I2V | 768p |
|
hailuo-2-3-768p-fast |
/v1/ai/image-to-video/minimax-hailuo-2-3-768p-fast | T2V/I2V | Fast 768p |
|
hailuo-live |
/v1/ai/image-to-video/minimax-live | I2V | Live illustrations, camera movements |
|
wan-2-6-1080p |
/v1/ai/image-to-video/wan-v2-6-1080p | I2V | 1080p I2V |
|
wan-2-6-720p |
/v1/ai/image-to-video/wan-v2-6-720p | I2V | 720p I2V |
|
wan-2-6-t2v-1080p |
/v1/ai/text-to-video/wan-v2-6-1080p | T2V | 1080p T2V |
|
wan-2-6-t2v-720p |
/v1/ai/text-to-video/wan-v2-6-720p | T2V | 720p T2V |
|
wan-2-5-i2v-1080p |
/v1/ai/image-to-video/wan-2-5-i2v-1080p | I2V | 1080p |
|
wan-2-5-i2v-720p |
/v1/ai/image-to-video/wan-2-5-i2v-720p | I2V | 720p |
|
wan-2-5-i2v-480p |
/v1/ai/image-to-video/wan-2-5-i2v-480p | I2V | 480p |
|
wan-2-5-t2v-1080p |
/v1/ai/text-to-video/wan-2-5-t2v-1080p | T2V | 1080p |
|
wan-2-5-t2v-720p |
/v1/ai/text-to-video/wan-2-5-t2v-720p | T2V | 720p |
|
wan-2-5-t2v-480p |
/v1/ai/text-to-video/wan-2-5-t2v-480p | T2V | 480p |
|
runway-4-5-t2v |
/v1/ai/text-to-video/runway-4-5 | T2V | 5/8/10s, multiple ratios |
|
runway-4-5-i2v |
/v1/ai/image-to-video/runway-4-5 | I2V | 5/8/10s, seed support |
|
runway-gen4-turbo |
/v1/ai/image-to-video/runway-gen4-turbo | I2V | Fast I2V |
|
runway-act-two |
/v1/ai/video/runway-act-two | V2V | Character performance transfer |
|
ltx-2-pro-t2v |
/v1/ai/text-to-video/ltx-2-pro | T2V | Up to 4K, optional audio |
|
ltx-2-pro-i2v |
/v1/ai/image-to-video/ltx-2-pro | I2V | Up to 4K, optional audio |
|
ltx-2-fast-t2v |
/v1/ai/text-to-video/ltx-2-fast | T2V | Fast, up to 4K |
|
ltx-2-fast-i2v |
/v1/ai/image-to-video/ltx-2-fast | I2V | Fast, up to 4K |
|
seedance-1-5-pro-1080p |
/v1/ai/video/seedance-1-5-pro-1080p | T2V/I2V | Synchronized audio (lip-sync, foley) |
|
seedance-1-5-pro-720p |
/v1/ai/video/seedance-1-5-pro-720p | T2V/I2V | 720p with audio |
|
seedance-1-5-pro-480p |
/v1/ai/video/seedance-1-5-pro-480p | T2V/I2V | 480p with audio |
|
seedance-pro-1080p |
/v1/ai/image-to-video/seedance-pro-1080p | I2V | 1080p |
|
seedance-pro-720p |
/v1/ai/image-to-video/seedance-pro-720p | I2V | 720p |
|
seedance-pro-480p |
/v1/ai/image-to-video/seedance-pro-480p | I2V | 480p |
|
seedance-lite-1080p |
/v1/ai/image-to-video/seedance-lite-1080p | I2V | Lite 1080p |
|
seedance-lite-720p |
/v1/ai/image-to-video/seedance-lite-720p | I2V | Lite 720p |
|
seedance-lite-480p |
/v1/ai/image-to-video/seedance-lite-480p | I2V | Lite 480p |
|
pixverse-v5 |
/v1/ai/image-to-video/pixverse-v5 | I2V | Stable style 360p-1080p |
|
pixverse-v5-transition |
/v1/ai/image-to-video/pixverse-v5-transition | I2V | Transition between two images |
|
omnihuman-1-5 |
/v1/ai/video/omni-human-1-5 | Audio-driven | Human animation from audio |
|
vfx |
/v1/ai/video/vfx | Effects | Apply VFX filters to video |
|
ref-kling-v3-omni-pro |
/v1/ai/reference-to-video/kling-v3-omni-pro | V2V | Video-to-video with reference (use @Video1 in prompt) |
|
ref-kling-v3-omni-std |
/v1/ai/reference-to-video/kling-v3-omni-std | V2V | Standard V2V |
Default: Use kling-v3-omni-pro for general video generation.
Kling 3 Omni Pro Example (text-to-video)
CODEBLOCK12
Kling 3 Omni parameters:
- -
prompt (string, max 2500 chars, required) - INLINECODE189 (URL) — for I2V
- INLINECODE190 /
end_image_url (URL) — start/end frames - INLINECODE192 (array of URLs) — reference images, use @Image1/@Image2 in prompt
- INLINECODE193 (array) — element consistency:
[{reference_image_urls: [...], frontal_image_url: "..."}], use @Element1/@Element2 in prompt - INLINECODE195 (array, max 6 shots) — multi-shot: INLINECODE196
- INLINECODE197 ("16:9" | "9:16" | "1:1")
- INLINECODE198 (3-15, seconds)
- INLINECODE199 (bool) — auto-generate audio
- INLINECODE200 (array) — use
<<<voice_1>>> in prompt - INLINECODE202 (string)
Poll status:
CODEBLOCK13
Kling 3 Example (with multi-shot)
CODEBLOCK14
RunWay Gen 4.5 Example (text-to-video)
CODEBLOCK15
RunWay 4.5 T2V parameters:
- -
prompt (string, max 2000 chars, required) - INLINECODE204 ("1280:720" | "720:1280" | "1104:832" | "960:960" | "832:1104", default "1280:720")
- INLINECODE205 (5 | 8 | 10)
- INLINECODE206
RunWay Gen 4.5 I2V Example
CODEBLOCK16
WAN 2.6 T2V Example
CODEBLOCK17
Hailuo Live Example (animated illustrations)
CODEBLOCK18
Hailuo Live camera movements: [Truck left], [Pan right], [Push in], [Pull out], [Zoom in], [Tracking shot], INLINECODE213
VFX Video Effects Example
CODEBLOCK19
VFX filter_type values: 1=Film Grain, 2=Motion Blur, 3=Fish Eye, 4=VHS, 5=Shake, 6=VGA, 7=Bloom, 8=Anamorphic Lens
VFX cost: $0.017 per second of video.
If $0 = "edit" — Image Editing
Edit, enhance, and transform images. $1 selects the operation.
Operations
| $1 value | Endpoint | Description |
|---|
| INLINECODE215 | INLINECODE216 | Prompt-guided upscaling with detail enhancement (Magnific). 2x/4x/8x/16x. |
| INLINECODE217 |
/v1/ai/image-upscaler-precision-v2 | Faithful upscaling with granular controls (Magnific) |
|
upscale-precision |
/v1/ai/image-upscaler-precision | High-fidelity upscaling without hallucinations |
|
relight |
/v1/ai/image-relight | Change image lighting via prompt, reference, or lightmap |
|
style-transfer |
/v1/ai/image-style-transfer | Apply artistic styles from reference images |
|
remove-bg |
/v1/ai/beta/remove-background | Remove background (SYNC, returns immediately) |
|
expand-flux |
/v1/ai/image-expand/flux-pro | Outpainting with Flux Pro |
|
expand-ideogram |
/v1/ai/image-expand/ideogram | Outpainting with Ideogram |
|
expand-seedream |
/v1/ai/image-expand/seedream-v4-5 | Outpainting with Seedream |
|
inpaint |
/v1/ai/ideogram-image-edit | Mask-based inpainting with Ideogram |
|
change-camera |
/v1/ai/image-change-camera | Transform camera angle/perspective |
|
skin-creative |
/v1/ai/skin-enhancer/creative | Artistic skin enhancement |
|
skin-faithful |
/v1/ai/skin-enhancer/faithful | Natural skin preservation |
|
skin-flexible |
/v1/ai/skin-enhancer/flexible | Targeted skin optimization |
Upscale Creative Example (Magnific)
CODEBLOCK20
Upscale Precision V2 Example
CODEBLOCK21
Precision V2 parameters:
- -
image (URL or base64, required) - INLINECODE244 (2-16)
- INLINECODE245 (0-100, default 7)
- INLINECODE246 (0-100, default 7)
- INLINECODE247 (0-100, default 30)
- INLINECODE248 ("sublime" | "photo" | "photo_denoiser")
- INLINECODE249
Remove Background Example (SYNCHRONOUS)
CODEBLOCK22
Image Expand Example (Outpainting)
For Image Expand, the user must provide an image URL. Use the Seedream or Ideogram expand endpoints which accept URLs, or ask the user to host the image first.
CODEBLOCK23
Image Expand parameters:
- -
image (URL or base64 — prefer URL, required) - INLINECODE251 (optional, auto-generated for Ideogram/Seedream)
- INLINECODE252 ,
right, top, bottom (0-2048 pixels each) - INLINECODE256 (int, for Ideogram/Seedream)
- INLINECODE257
Note: For Flux Pro expand, the image param requires base64. Prefer using Seedream V4.5 or Ideogram expand endpoints which accept URLs.
Inpainting Example (Ideogram)
CODEBLOCK24
Inpainting parameters:
- -
image (URL or base64, max 10MB, required) - INLINECODE260 (B&W image, same size, required — black = areas to edit)
- INLINECODE261 (required)
- INLINECODE262 ("TURBO" | "DEFAULT" | "QUALITY")
- INLINECODE263 ("AUTO" | "ON" | "OFF")
- INLINECODE264 ("AUTO" | "GENERAL" | "REALISTIC" | "DESIGN")
- INLINECODE265 (array),
style_reference_images (array), character_reference_images (array) - INLINECODE268 (object)
- INLINECODE269 (0-2147483647)
- INLINECODE270
Change Camera Example
CODEBLOCK25
Change Camera parameters:
- -
image (HTTPS URL, JPG/PNG/WebP, required) - INLINECODE272 (0-360, default 0)
- INLINECODE273 (-30 to 90, default 0)
- INLINECODE274 (0-10, default 5)
- INLINECODE275 ("png" | "jpeg")
- INLINECODE276 (min 1)
- INLINECODE277
Image Relight Example
CODEBLOCK26
Skin Enhancer Example
CODEBLOCK27
Skin Enhancer optimized_for options: "enhanceskin" | "improvelighting" | "enhanceeverything" | "transformtoreal" | "nomake_up"
If $0 = "icon" — Icon Generation
Generate icons from text prompts in PNG or SVG format.
Endpoint: INLINECODE279
CODEBLOCK28
Parameters:
- -
prompt (string, required) — icon description - INLINECODE281 ("solid" | "outline" | "color" | "flat" | "sticker", default "solid")
- INLINECODE282 ("png" | "svg", default "png")
- INLINECODE283 (10-50, default 10)
- INLINECODE284 (0-10, default 7)
- INLINECODE285 (string, required but can be empty "")
Preview (quick preview before full render):
CODEBLOCK29
Download rendered icon:
curl -s -X POST "https://api.freepik.com/v1/ai/text-to-icon/$TASK_ID/render/svg" \
-H "x-freepik-api-key: $FREEPIK_API_KEY" \
-o ~/.freepik/sessions/${CLAUDE_SESSION_ID}/icon_$(date +%s).svg
If $0 = "audio" — Audio Generation
Generate music, sound effects, voiceover, or isolate audio. $1 selects the type.
| $1 value | Endpoint | Description |
|---|
| INLINECODE287 | INLINECODE288 | Text-to-music (10-240s, MP3) |
| INLINECODE289 |
/v1/ai/sound-effects | Sound effects (0.5-22s) |
|
voiceover |
/v1/ai/voiceover/elevenlabs-turbo-v2-5 | Text-to-speech (ElevenLabs) |
|
isolate |
/v1/ai/audio-isolation | Isolate specific sounds from audio/video |
Music Example
CODEBLOCK31
Music parameters:
- -
prompt (string, required) - INLINECODE296 (10-240, required)
- INLINECODE297 (HTTPS URL)
Sound Effects Example
CODEBLOCK32
Sound Effects parameters:
- -
text (string, max 2500 chars, required) - INLINECODE299 (0.5-22, required)
- INLINECODE300 (bool, default false) — seamless looping
- INLINECODE301 (0-1, default 0.3)
- INLINECODE302 (HTTPS URL)
Voiceover Example (ElevenLabs TTS)
CODEBLOCK33
Voiceover parameters:
- -
text (1-40000 chars, UTF-8, required) - INLINECODE304 (ElevenLabs voice ID, required)
- INLINECODE305 (default "eleventurbov2_5")
- INLINECODE306 (0-1, default 0.5)
- INLINECODE307 (0-1, default 0.2)
- INLINECODE308 (0.7-1.2, default 1.0)
- INLINECODE309 (bool, default true)
- INLINECODE310
Audio Isolation Example
CODEBLOCK34
Audio Isolation parameters:
- -
description (string, required) — what sound to isolate - INLINECODE312 (URL or base64 — WAV/MP3/FLAC/OGG/M4A) OR
video (URL or base64 — MP4/MOV/WEBM/AVI) - INLINECODE314 ,
y1, x2, y2 (bounding box for video, default 0) - INLINECODE318 (1-5, default 2)
- INLINECODE319 (1-8, default 1)
- INLINECODE320 (bool, default false)
- INLINECODE321
- Output: WAV audio file
If $0 = "stock" — Stock Content
Search and download stock photos, vectors, icons, and videos. $1 selects the content type.
| $1 value | Endpoint | Description |
|---|
| INLINECODE323 | INLINECODE324 | Search photos, vectors, PSDs |
| INLINECODE325 |
/v1/icons | Search icons |
|
videos |
/v1/videos | Search stock videos |
Search Stock Images
CODEBLOCK35
Get Resource Details
CODEBLOCK36
Download Resource
CODEBLOCK37
Search Stock Icons
CODEBLOCK38
Download Stock Icon
CODEBLOCK39
Search Stock Videos
CODEBLOCK40
Download Stock Video
curl -s "https://api.freepik.com/v1/videos/$VIDEO_ID/download" \
-H "x-freepik-api-key: $FREEPIK_API_KEY" \
-o ~/.freepik/sessions/${CLAUDE_SESSION_ID}/video_$(date +%s).mp4
If $0 = "status" — Check Task Status
Check the status of any async task. $1 is the task ID. You need to know the endpoint path.
CODEBLOCK42
Common status endpoint paths:
- - Mystic: INLINECODE330
- Flux models: INLINECODE331
- Kling 3 Omni: INLINECODE332
- Kling 3: INLINECODE333
- I2V models: INLINECODE334
- T2V models: INLINECODE335
- Upscaler:
image-upscaler/<task-id> or INLINECODE337 - Icon: INLINECODE338
- Music: INLINECODE339
- Sound Effects: INLINECODE340
- Audio Isolation: INLINECODE341
Task statuses: CREATED → IN_PROGRESS → COMPLETED or FAILED
If $0 = "utility" — AI Utilities
Various AI helper tools. $1 selects the utility.
| $1 value | Endpoint | Description |
|---|
| INLINECODE347 | INLINECODE348 | Detect if image is AI-generated (SYNC) |
| INLINECODE349 |
/v1/ai/image-to-prompt | Reverse-engineer prompt from image |
|
improve-prompt |
/v1/ai/improve-prompt | Enhance prompts for generation |
|
lip-sync |
/v1/ai/lip-sync/latent-sync | Synchronize lip movements with audio |
AI Image Classifier (SYNCHRONOUS)
curl -s -X POST "https://api.freepik.com/v1/ai/classifier/image" \
-H "x-freepik-api-key: $FREEPIK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"image": "https://example.com/photo.jpg"}'
Response: Array of INLINECODE355
Image to Prompt
CODEBLOCK44
Improve Prompt
CODEBLOCK45
Parameters:
- -
prompt (max 2500 chars, required — can be empty for creative generation) - INLINECODE357 ("image" | "video", required)
- INLINECODE358 (ISO 639-1, default "en")
- INLINECODE359
Lip Sync
curl -s -X POST "https://api.freepik.com/v1/ai/lip-sync/latent-sync" \
-H "x-freepik-api-key: $FREEPIK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"audio": "https://example.com/speech.mp3",
"video": "https://example.com/face.mp4"
}'
Model Selection Guide
For image generation:
- - Want ultra-realistic? →
mystic (Freepik exclusive, recommended) - Need text in image / poster? → INLINECODE361
- Want fastest? →
flux-2-klein (sub-second) or INLINECODE363 - Need high quality? →
flux-2-pro or INLINECODE365 - Budget-friendly? → INLINECODE366
For video generation:
- - General purpose / best quality? → INLINECODE367
- Need multi-shot? →
kling-v3-pro or INLINECODE369 - Character performance? → INLINECODE370
- Animated illustrations? → INLINECODE371
- With synchronized audio? → INLINECODE372
- Budget / fast? →
kling-v3-omni-std or INLINECODE374 - Up to 4K? →
ltx-2-pro-t2v or INLINECODE376 - Human animation from audio? → INLINECODE377
For image editing:
- - Creative upscale? → INLINECODE378
- Faithful upscale? → INLINECODE379
- Change lighting? → INLINECODE380
- Remove background? → INLINECODE381
- Extend canvas? →
expand-flux or INLINECODE383 - Edit specific area? → INLINECODE384
- Change perspective? → INLINECODE385
For icons:
- - Always use
icon command — choose style (solid/outline/color/flat/sticker) and format (png/svg)
For audio:
- - Background music? →
music (10-240s) - Sound effect? →
sfx (0.5-22s) - Narration/speech? → INLINECODE389
- Extract specific sound? → INLINECODE390
Freepik API 技能
使用 Freepik API 生成图像、视频、图标、音频、编辑图像以及搜索素材内容。
由 ShellBot 团队构建。
参数
- - 命令: $0(generate | video | edit | icon | audio | stock | status | utility)
- 参数 1: $1(模型名称、操作类型或任务 ID)
- 参数 2+: $2、$3 等(附加参数)
- 所有参数: $ARGUMENTS
会话输出
将生成的文件保存到会话文件夹:
bash
mkdir -p ~/.freepik/sessions/${CLAUDESESSIONID}
下载的图像/视频/音频保存至:~/.freepik/sessions/${CLAUDESESSIONID}/
身份验证
所有请求都需要 FREEPIKAPIKEY 环境变量。
请求头: x-freepik-api-key: $FREEPIKAPIKEY
基础 URL: https://api.freepik.com
如果请求返回 401/403 错误,请告知用户:
从 https://www.freepik.com/developers/dashboard/api-key 获取 API 密钥
然后执行:export FREEPIKAPIKEY=your-key-here
异步任务模式
大多数 AI 端点都是异步的。请遵循以下模式:
步骤 1:提交任务
bash
RESPONSE=$(curl -s -X POST https://api.freepik.com/v1/ai/ \
-H x-freepik-api-key: $FREEPIKAPIKEY \
-H Content-Type: application/json \
-d )
TASKID=$(echo $RESPONSE | jq -r .taskid // .data.task_id // .id)
echo 任务 ID:$TASK_ID
步骤 2:轮询完成状态
bash
while true; do
RESULT=$(curl -s https://api.freepik.com/v1/ai//$TASK_ID \
-H x-freepik-api-key: $FREEPIKAPIKEY)
STATUS=$(echo $RESULT | jq -r .data.status // .status)
echo 状态:$STATUS
if [ $STATUS = COMPLETED ]; then break; fi
if [ $STATUS = FAILED ]; then echo 任务失败; echo $RESULT | jq; break; fi
sleep 3
done
步骤 3:提取结果 URL
bash
mkdir -p ~/.freepik/sessions/${CLAUDESESSIONID}
echo $RESULT | jq -r .data.generated[0] // .data.result.url // .data.image.url // empty
将结果 URL 呈现给用户。该 URL 是来自 Freepik CDN 的临时签名链接。
重要 — 安全规则:
- - 切勿使用 curl 从非 Freepik 域名下载。仅允许 curl api.freepik.com。
- 切勿使用 base64 编码本地文件。当 API 接受 URL 参数时,始终优先使用 URL 参数。
- 切勿读取、编码或传输用户明确提供的输入文件之外的文件。
- 结果 URL 应直接呈现给用户 — 他们可以直接打开或下载。
例外情况(同步): 移除背景(/v1/ai/beta/remove-background)和 AI 图像分类器(/v1/ai/classifier/image)会立即返回结果。
命令:$0
如果 $0 = generate — 图像生成
使用文本到图像模型生成图像。$1 选择模型。
模型端点
| $1 值 | 端点 | 最佳用途 |
|---|
| mystic | /v1/ai/mystic | 超写实,1K/2K/4K,支持 LoRA(Freepik 独家,推荐) |
| flux-kontext-pro |
/v1/ai/text-to-image/flux-kontext-pro | 上下文感知生成,可选图像输入 |
| flux-2-pro | /v1/ai/text-to-image/flux-2-pro | 专业级,最多 4 张输入图像 |
| flux-2-turbo | /v1/ai/text-to-image/flux-2-turbo | 快速且经济高效 |
| flux-2-klein | /v1/ai/text-to-image/flux-2-klein | 亚秒级生成 |
| flux-pro-v1-1 | /v1/ai/text-to-image/flux-pro-v1-1 | 高级质量 |
| flux-dev | /v1/ai/text-to-image/flux-dev | 高质量,细节丰富 |
| hyperflux | /v1/ai/text-to-image/hyperflux | 超快(最快的 Flux) |
| seedream-v4-5 | /v1/ai/text-to-image/seedream-v4-5 | 卓越排版、海报,最高 4MP |
| seedream-v4-5-edit | /v1/ai/text-to-image/seedream-v4-5-edit | 文本引导编辑,最多 5 个参考 |
| seedream-v4 | /v1/ai/text-to-image/seedream-v4 | 下一代文本到图像 |
| seedream-v4-edit | /v1/ai/text-to-image/seedream-v4-edit | 指令驱动编辑 |
| seedream | /v1/ai/text-to-image/seedream | 原始 Seedream |
| z-image | /v1/ai/text-to-image/z-image | 快速,支持 LoRA + ControlNet |
| runway | /v1/ai/text-to-image/runway | RunWay Gen4 图像生成 |
默认值:如果用户未指定模型,则使用 mystic。
Mystic 示例
bash
curl -s -X POST https://api.freepik.com/v1/ai/mystic \
-H x-freepik-api-key: $FREEPIK
APIKEY \
-H Content-Type: application/json \
-d {
prompt: 日落时分的未来城市景观,照片级真实感,
resolution: 2k,
styling: {
style: photo
}
}
Mystic 参数:
- - prompt(字符串,必填)— 要生成的内容
- resolution(1k | 2k | 4k,默认 2k)
- numimages(1-4,默认 1)
- styling.style(photo | digitalart | none)
- structurereference(对象)— 使用图像引导构图:{imageurl, strength: 0-100}
- stylereference(对象)— 使用图像引导风格:{imageurl, strength: 0-100}
- loras(数组)— 来自 /v1/ai/loras 的 LoRA ID
- seed(整数)— 用于可重复性
- webhook_url(字符串)— 完成后接收通知
获取可用的 LoRA:
bash
curl -s https://api.freepik.com/v1/ai/loras \
-H x-freepik-api-key: $FREEPIKAPIKEY | jq .data[] | {id, name, type}
训练自定义 LoRA(角色):
bash
curl -s -X POST https://api.freepik.com/v1/ai/loras/characters \
-H x-freepik-api-key: $FREEPIKAPIKEY \
-H Content-Type: application/json \
-d {name: my-character, images: [orurl>, ...]}
Flux 2 Klein 示例(亚秒级)
bash
curl -s -X POST https://api.freepik.com/v1/ai/text-to-image/flux-2-klein \
-H x-freepik-api-key: $FREEPIK
APIKEY \
-H Content-Type: application/json \
-d {
prompt: 一只戴着太阳镜的猫,
aspect
ratio: square1_1,
resolution: 1k,
output_format: